Reputation: 77
I'm getting an error when switch to popup window. My case:
- Open
Login page
.- Enter username & password
- Click
Login button
(after clicking, display popup window and main window is closed at the same time).- Click a button on popup window. ....
Here's my script:
Open Browser | ${login page url} | IE
Wait Until Element Is Visible | id=username_tbx |
Input Text | id=username_tbx | username1
Input Text | id=password_tbx | password1
Click Element | id=login_btn | #after clicking, the popup is displayed
@{Window Names} |Wait Until Keyword Succeeds | 20s | 1s | Get Window Names
Select Window | @{Window Names}[1] |
Click Element | id=something_btn |
The script is failed when the main window is closed and popup is displayed. I can not get the name of the popup window.
The log message is:
20150518 17:39:33.544 : INFO : Clicking element 'id=login_btn'.
20150518 17:39:36.724 : FAIL :
NoSuchWindowException: Message: Unable to get browser
20150518 17:39:36.725 : WARN :
Keyword 'Capture Page Screenshot' could not be run on failure: NoSuchWindowException: Message: Unable to get browser
20150518 17:39:36.808 : FAIL :
NoSuchWindowException: Message: Window is closed
....
....
20150518 17:39:57.474 : FAIL :
Timeout 20 seconds exceeded. The last error was: NoSuchWindowException: Message: Window is closed
Ending test: Demo.Scenario.1.TC_1
I'm getting this problem both on IE10, 11
So, why can't I get the window names?
And please show me how to solve this problem?
Thanks in advance.
Upvotes: 0
Views: 1650
Reputation: 37
Try keeping the same value for each zone in the Protected Mode settings.
To set the Protected Mode settings, choose "Internet Options" from the Tools menu, and click on the “Security” tab. For each zone, there will be a check box at the bottom of the tab labeled "Enable Protected Mode". This checkbox should be checked or unchecked for each zone.
This value can be enabled or disabled as long as it is the same for every zone – Internet, Local Intranet, Trusted sites, Restricted sites. Recommend it to be kept as enabled since unchecking it would put your computer at risk.
This above solution worked for us.
Reason - Seems like the browser was detecting the 2nd window or its URL as a potential Security Threat and was running the Internet Explorer process with greatly restricted privileges. Because of which RobotFramework (Selenium2Library) was not able to detect the 2nd window.
Thanks and Regards,
Ryan M
Upvotes: 0
Reputation: 77
With the latest release of Selenium2Library (v1.7.0)
, my script can run successfully and do not have any error. My problem is solved
Thank development team!
Upvotes: 1