I use Browserstack (not with RF), but let's see how you can do it. I believe similar approach might be possible with Sauce Labs.
First I need some variables:
*** Variables ***
${base_url} https://www.google.com/
${os} windows
${os_version} 10
${browser} chrome
${browser_version} 84
${browserstack_username} username
${browserstack_accesskey} secret
You especially choose what OS and browser you want to run your tests in Browserstack: ${os}
, ${os_version}
, ${browser}
, and ${browser_version}
.
Currently, I am passing the variable browser from command line.
You can keep doing it with the above-mentioned four variables.
Then you need to open a browser in Browserstack:
*** Keywords ***
Open Browser In Browserstack
${remoteUrl} Set Variable http://${browserstack_username}:${browserstack_accesskey}@hub.browserstack.com:80/wd/hub
&{desired_capabilities} Create Dictionary os=${os} os_version=${os_version} browser=${browser} browser_version=${browser_version}
Open Browser ${baseUrl} remote_url=${remote_url} desired_capabilities=${desired_capabilities}
And so you can then put it all together:
*** Settings ***
Library SeleniumLibrary
*** Variables ***
${base_url} https://www.google.com/
${os} windows
${os_version} 10
${browser} chrome
${browser_version} 84
${browserstack_username} username
${browserstack_accesskey} secret
*** Keywords ***
Open Browser In Browserstack
${remoteUrl} Set Variable http://${browserstack_username}:${browserstack_accesskey}@hub.browserstack.com:80/wd/hub
&{desired_capabilities} Create Dictionary os=${os} os_version=${os_version} browser=${browser} browser_version=${browser_version}
Open Browser ${baseUrl} remote_url=${remote_url} desired_capabilities=${desired_capabilities}
*** Test Cases ***
Browserstack
Open Browser In Browserstack
When I navigate to Browserstack, I can see my test:
I think this what I've shown is really all you need, but:
to run the above test case at the same time
well, I feel you can use what's already available, e.g. pabot. I have never tried this, so you can give it a try and let me know in the comment section if it works.