SeleniumLibrary
SeleniumLibrary copied to clipboard
'options' argument in 'open browser' not honored when 'browser' argument is set to 'edge' or 'safari'
Problem statement: Executing tests using Remote webdriver on BrowserStack but the options object passed under the 'options' parameter under the 'open browser' keyword doesn't get honored when the 'browser' parameter is set to 'edge' or 'safari'.
However, this works when the 'browser' argument is set to either 'chrome' or 'firefox'.
Note: The same also works across all browser argument values when using selenium 3.141.0 and desired_capabilities
Setup information: python 3.7.12 robotframework 5.0.1 robotframework-seleniumlibrary 6.0.0 selenium 4.3.0
Steps to repro:
- Create the below-mentioned files:
test.robot
*** Settings *** Library SeleniumLibrary Library Collections Library test.py
*** Variables *** ${test_url}= https://google.com ${USERNAME}= %{BROWSERSTACK_USERNAME} ${ACCESSKEY}= %{BROWSERSTACK_ACCESS_KEY} ${REMOTE_URL}= https://${USERNAME}:${ACCESSKEY}@hub-cloud.browserstack.com/wd/hub
*** Keywords *** Open Session ${opts}= browserstack test open browser remote_url=${REMOTE_URL} url=${test_url} options=${opts} browser=edge
*** Test Cases *** Quick Test Open Session close browser
test.py
from selenium.webdriver.edge.options import Options
def browserstack_test(): edge_options = Options()
bstack_caps = {
"os" : "Windows",
"osVersion" : "8",
"debug" : "true"
}
edge_options.set_capability("browserVersion", "90")
edge_options.set_capability("bstack:options", bstack_caps)
return edge_options
========================================
- Create a free account on BrowserStack
- Set the BrowserStack username and accesskey of the account under the following env variables on your machine: BROWSERSTACK_USERNAME BROWSERSTACK_ACCESS_KEY
- Run the test --> robot test.robot
You'll notice that the test runs on a random version of Edge and the 'options' argument doesn't seem to get honored at all.