3

I am using Robot Framework IDE with the Selenium2Library.

Now my problem:

My test opens Firefox and goes to a page. On this page is a link. I have to click on the link and continue testing on the new page. But the link do not open in the same browser window. I tried to get to the new window with the Keyword "select window" with url=https//... (thats the url of the page that opens in the new browser window) but the localization is still on the first browser window. I also tried the keyword "switch browser" with the url of the second window but it does not work too.

Does anybody have an idea how I can switch to the other browser window?

An other idea is to get the url of the link and open it in a new browser window by the keyword "open browser". But I do not have any idea how to get the url of the link?

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
carabinieri
  • 53
  • 2
  • 4
  • 1
    There is a way to switch to a new window using selenium webdriver. Here's the [link](http://stackoverflow.com/a/9597714/4193730) – Subh Nov 14 '14 at 15:31

3 Answers3

4

Try switching to new window based on it's title:

Select Window title=<Title of the new window>

You can get window titles using - Get Window Titles

Surya
  • 4,446
  • 2
  • 17
  • 19
0

i had same problem. Here is a solution:

${exportlink}=  Get Element Attribute   name=exportUrl@value        
Log ${exportlink}           
sleep   2           
${exportwindow}=    Replace String  url=ExportLink  ExportLink               ${exportlink}
Log ${exportwindow}         
Go to   ${exportlink}           
Select Window   ${exportwindow}         
Wait Until Page Contains Element    xpath=/html/body    300     
Wait Until Page Contains    Export is completed.    300     
0

By default, the locator is matched against window handle, name, title, and URL. Matching is done in that order and the first matching window is selected.

You can switch to a new window by adding the following script-

Switch Window locator=NEW

ishaj
  • 91
  • 1
  • 4