Reputation: 33
In my test case, I have to open two browsers and Switch to the first browser opened, but the Switch Browser isn't working for me, the command doesn't return any error but doesn't switch the browser.
I Already tried using the command using index and alias but nothing worked.
Open browser ${url} ${browser} 1
Open Browser ${url} Firefox
Switch Browser 1
My code:
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
Two Browsers
Open browser ${url} ${browser} 1
Do some actions...
Open Browser ${url} Firefox
Do some actions...
Switch Browser 1
When the command Switch Browser is executed nothing happened, doesn't change of browser.
I tried using the command Press Keys None ALT+TAB
but this doesn't work too.
When I Use the command Get Window Identifiers
return information about only one browser.
Upvotes: 0
Views: 4213
Reputation: 11
Switch Browser actually works. If you try to switch browser to first window try to click an element/input text it will work but it will not change the view.
Example:
First Browser - Google
Second Browser - Bing
Switch browser 1 (Which is the first browser)
Input text to Search bar (Use any locator)
Upvotes: 1
Reputation: 11
You can have aliases for diffrent browsers to navigate between them
*** Keywords ***
Open Browser Window with Alias 1
Open Browser about:blank ${defaultBrowser} alias=${window_alias_1} remote_url=${env}
maximize browser window
Open Browser Window with Alias 2
Open Browser about:blank ${defaultBrowser} alias=${window_alias_2} remote_url=${env2}
maximize browser window
Switch to Browser with Alias 1
switch browser ${window_alias_1}
Switch to Browser with Alias 2
switch browser ${window_alias_2}
*** Test Case ***
Test
Open Browser Window with Alias 1
# do your logic here for browser 1
Open Browser Window with Alias 2
# do your logic here for browser 2
Switch to Browser with Alias 2
#some more logic
Switch to Browser with Alias 1
${log} Finished
Upvotes: 1