Not able to use desired_capabilities

Hi there,
I have windows 11 and selenium 4.4.3 on my PC
and was trying to use sauce labs to execute automation tests on safari with this keyword

Open Browser ${URL} ${Browser} remote_url= desired_capabilities=name:MacOS Test,platform:macOS 13, browserName:Safari,version:15

however I’m getting following error:
desired_capabilities has been deprecated and removed. Please use options to configure browsers as per documentation.

not able to understand the usage of “options” through documentation. can someone point me towards a working example in robot script?

Here is an example with the browser version

*** Settings ***
Library  SeleniumLibrary

*** Test Cases ***
Check Using Chrome Version 114
    Open Browser    ${None}    Chrome    options=browser_version("114")

Options can be a bit tricky as there is both options which have values - like broswer_version which has a value of “114” and then arguments which have both an argument name and value but come into the options as shown in the Open Browser keyword doc. For example,

Open Browser	None	Chrome	options=binary_location="/path/to/binary";add_argument("remote-debugging-port=port")

which has an argument remote-debugging-port with a value of port. Here too is an option of binary_location. This may be clear to some but I will admit I get confused in here sometimes myself.

Some resources

Sauce Labs Configuration Documentation
And linked through the Sauce Labs is the Selenium Doc for Options.

2 Likes

[Bit busy this morning so trying to find some more resources and real examples … but wanted to let you know I might not get to these till later…]

Another resource is Josh Grant’s 2022 RoboCon Talk on using cloud providers. Josh was a Sauce Labs Engineer. I don’t recall what is here in the video but it may be helpful.

Beyond the browser version above from your script I believe the “desired” operating systems values might be some sort of Sauce Labs specific options which I don’t know where those go. Searching their doc might turn up those.

Finally there was an issue with SeleniumLibrary 6.1.2 which as I re-read it shouldn’t affect you. (It is if option is blank for remote url). But just in case there is a beta release which I need to make the formal release to later today if possible.

2 Likes

thanks EdManlove! will check these out. lets see if these get me a solution :slight_smile:

Did scroll down on the Sauce Labs Doc to see platformName is actually part of the w3c spec as an option. So not Sauce Labs specific. As with browserVersion, the python implementation uses platform_name which differs than the w3c spec name platformName. One last resource which I should have given is the Selenium Python API docs and in particular the two sections on

Common options used by all browsers

and then the Chrome options

[Here is the link to the main page for the Python API which one can find, amongst other things, the rest of the browser specific options.]

1 Like