How to disable warning message when using the keyword "Select Window"

2,749 views
Skip to first unread message

Phuoc Ha

unread,
Jan 5, 2015, 5:13:40 AM1/5/15
to robotframe...@googlegroups.com
Hi guys,

Please help me to disable message warning for keyword "Select Window"

My scenario:
Step 1: Login page by User1,   
Step 2: logout that page,
Step 3: Use User2 Login page again

Test Case Login
    Log In     https://mypage.com      user1     pass01
    Click Link     link=logout
    Log In     https://mypage.com      user2     pass02
    Click Link     link=logout

*** Keywords ***
Log In
    [Arguments]    ${url}    ${un}    ${pw}
    [Documentation]    COMMON_KEY: Login my page
    ${value}    Run Keyword And Return Status    Select Window    title=My Page - Users Login
    Run Keyword If    ${value}    Log    Windown is selected.    ELSE    Open My Browser    ${url}
    Input Text     id=username      ${un}
    Input Text     id=password       ${pw}
    Click Button   id=Login

Open My Browser
    [Arguments]    ${url}   
    Open Browser    ${url}   

In the step1, I've got an message "[ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: No browser is open"
What keyword I can use ? to disable the warn above?


Thanks for your help!
Regards,
Phuoc Ha.

Tatu Aalto

unread,
Jan 7, 2015, 2:00:02 AM1/7/15
to Phuoc Ha, robotframework-users

Ugh

I did not test my proposal but I would assume that disabling temporary the Selenium2Library run on failure functionality [1] should solve your problems. I would modify your keyword to look like this:

    [Documentation]    COMMON_KEY: Login my page

    ${kw}=    Register Keyword To Run On Failure    Nothing


    ${value}    Run Keyword And Return Status    Select Window    title=My Page - Users Login

    Register Keyword To Run On Failure    ${kw}
    Run Keyword If...

-Tatu
Send from my mobile
[1] http://rtomac.github.io/robotframework-selenium2library/doc/Selenium2Library.html#Register%20Keyword%20To%20Run%20On%20Failure

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

Phuoc Ha

unread,
Jan 8, 2015, 5:20:11 AM1/8/15
to robotframe...@googlegroups.com, phuo...@gmail.com
Hi Tatu,

Thanks for your help!
So my mean is how to hide warning when I use keyword: "Select Window    title=My Page - Users Login"
When I select that window "title=My Page - Users Login", but there are no window exist.
I'm just want to know how to disable that warning only

Regards,
Phuoc Ha.

Vào 14:00:02 UTC+7 Thứ tư, ngày 07 tháng một năm 2015, Tatu Aalto đã viết:
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

Tatu Aalto

unread,
Jan 9, 2015, 10:37:28 AM1/9/15
to Phuoc Ha, robotframework-users

Ugh

Not directly from the Robot Framework, but I did look at the source code of the S2L keyword. It should be fairly easy to modify the code to suppress the message to console when required.

-Tatu
Send from my mobile

To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.

Phuoc Ha

unread,
Jan 11, 2015, 10:43:39 PM1/11/15
to robotframe...@googlegroups.com, phuo...@gmail.com
Hi Tatu,

I have understand what's your mean
Hi it's working now, many thanks for your help Tatu :D

Sincerely,
Phuoc Ha.

Vào 22:37:28 UTC+7 Thứ Sáu, ngày 09 tháng 1 năm 2015, Tatu Aalto đã viết:
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsubscrib...@googlegroups.com.

To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

Joydeep Das

unread,
May 15, 2018, 9:09:17 AM5/15/18
to robotframework-users
Thanks Tatu,

This really helped.

Used the below keywords and embedded inside my code so i don't get unnecessary warning when i don't intend to.

*** Keywords ***
stop screenshot
Register Keyword To Run On Failure Nothing
start screenshot
Register Keyword To Run On Failure capture page screenshot

duplicate_entity_checker_generic
[arguments] ${txt}
stop screenshot
${found_} run keyword and return status page should contain ${txt}
run keyword if ${found_}==1 LOG ${txt} Exception Handled. WARN
start screenshot
[return] ${found}

Thanks
joydeep
Reply all
Reply to author
Forward
0 new messages