Hi,
could someone post example code for creating two browser instances and switching between those using Robot Framework’s Browser (NOT using SeleniumLibrary) library?
Namely: how to obtain correct browser id for Switch Browser keyword.
Switch Browser ${ibrowser1_id}
Full code so far:
Library Browser
Library String
Library Collections
** Variables **
${url1}= https://www.google.com
${url1}= https://www.bing.com
@{browser_ids}= Create List
** Test Cases **
Open Browser 1
New Browser chromium headless=false
New Context viewport={'width': 1920, 'height': 1080}
New Page ${url1}
Open Browser 1
New Browser chromium headless=false
New Context viewport={'width': 1920, 'height': 1080}
New Page ${url2}
Browser library has automatic teardown for Browser/Context/Page instances, so you have to create all needed instances of those in Suite Setup. Solution below:
Open to designer keyword just call New Browser and New Context and New Page
this test case is in a file in an upper directory. All my real tests are in sub directories and start with a loop
*** Test Cases ***
ParseAllBrowser
[Documentation] loop on browsers and test each keywords
${browserList} Get Browser Ids
FOR ${browserInstance} IN @{browserList}
CreatePlaformeByMenu ${browserInstance}
END