robotframework / SeleniumLibrary

Web testing library for Robot Framework
Apache License 2.0
1.38k stars 759 forks source link

How replace desired_capabilities for Browserstack integration #1876

Closed anthonyOSF closed 9 months ago

anthonyOSF commented 9 months ago

Hello,

Since desired_capabilities are deprecated, i would like to know which syntax i should use now

Code Before Open Browser ${URL} | ${BROWSER} | remote_url=${RemoteURL} | desired_capabilities=project:myprojectname,name:${TEST_NAME},browser:${BROWSER}

The seleniumlibrary documentation tells us to use the argument option, can you give me an example?

SeleniumLibrary 6.2.0 RobotFramework 6.1.1

Thanks a lot

emanlove commented 9 months ago

@anthonyOSF Going to try to give first a partial answer and explain later so you have something to start working on. Pressed on a few things at the moment and might not get back to this for a day or so ..

Short answer .. from here and here and a few other places including here I believe it should start to look like

Open Browser ${URL} | ${BROWSER} | remote_url=${RemoteURL} | options=set_capability("bstack:options", {'projectName' : 'myprojectname', 'sessionName' : '${TEST_NAME}'})

In the above I don't use the last desired_capabilities of browser as I could not seem to find how Browserstack is shifting the previous desired capabilities to options for this specifc value using this document. There is browserName - noting that the python selenium bindings choose to go with the underscore instead of camel case spelling of all these options - but I think this is handle by using the Chrome Options class which SeleniumLibrary does internally. Gouing to hand this off now and let you do so debugging and trying out .. will come back later with some more explanation of how I got here .. have a good day! :)

anthonyOSF commented 9 months ago

Hello @emanlove, thx a lot ! it was exactly what i needed ! Thank you for your quick and precise response.