The easiest, fastest and most reliable way is to launch a browser on the same machine with the test (the so-called βlocalβ launch). Or maybe in a Docker container on the same machine.
But people are not looking for simple ways. Sometimes they want to run the browser in the clouds. In theory, this can give you some advantages: infinite scaling and running different versions of different browsers. But of course, there are also difficulties and limitations.
Selenide allows you to do this quite easily.
To run a browser remotely, you need to use setting remote
:
Configuration.remote = "https://your-cloud-provider.com/wd/hub";
Allows running a browser in a docker container with just one annotation.
A working example: selenide-examples/testcontainers.
Pros:
Cons:
A working example: selenide-examples/selenide-lambdatest.
Website: LambdaTest.com.
This is a working example of Selenide tests that run the browser on LambdaTest servers. As you can see, the settings there are minimal:
Configuration.remote = "https://hub.lambdatest.com/wd/hub";
Configuration.browserCapabilities.setCapability("LT:Options", Map.of(
"user", "unclebob",
"accessKey", "0123456789001234567890"
));
Pros:
Cons:
A working example: selenide-examples/selenide-browserstack.
Website: BrowserStack.com
This is a working example of Selenide tests that run the browser on BrowserStack servers. As you can see, the settings there are minimal:
Configuration.remote = "https://hub-cloud.browserstack.com/wd/hub";
Configuration.browserCapabilities.setCapability("bstack:options", Map.of(
"userName", "unclebob",
"accessKey", "0123456789001234567890"
));
Pros:
Cons:
Saucelabs company also allows running browsers and mobile apps on their servers.
An example (this is quite old, but we hope to update it soon).
Pros:
Cons:
Like Selenium Grid, but in docker. And itβs written in Go, so itβs fast and uses little memory.
A working example on GitHub
Pros:
Directly supported by Selenide
1.1. Is easily pluggable as a Selenide extension βcom.codeborne:selenide-selenoid:7.5.0β
1.2. Supports some Selenide features (that may not work in other clouds): clipboard, downloading files.
Cons:
In theory, other cloud providers should integrate just as easily.
What other providers have you tried? Pros, cons, pitfalls? Tell us, share the code.
And the most important, was it worth it? Tell us, what kind of problems does remote browser run solve, why was it worth sacrificing speed, convenience and some features?