1

Following the question : Automated testing with Robot framework : Switching beetween windows that open on the same browser a second issue arises.

How do I make it stay on the new tab if the original and the new tab have the same title.

I click the element, a new tab opens, then it switches to the original tab.

If I take out the Switch Window keyword, it stays on the new tab but it doesn't find the next element, I imagine because it is looking in the original tab.

Click Element //*[@id="id1"]

Sleep 3 seconds

Switch Window TAb 2

Wait Until Page Contains Element //*[@id="id2"]

Click Element //*[@id="id3"]

Sleep 20 seconds

Is it possible to solve this ?

  • https://robotframework.org/SeleniumLibrary/SeleniumLibrary.html#Switch%20Window ... Use handle as locator instead of tab name .. https://robotframework.org/SeleniumLibrary/SeleniumLibrary.html#Get%20Window%20Handles – rasjani Sep 08 '21 at 10:16

1 Answers1

0

You can try using window handles and switch to the particular tab

Identify and switch to first window @{list1} get window handles Switch Window ${list1}[1] -- this will switch to the latest tab opened

snehal
  • 1
  • 1