I have been trying to set up Selenoid for parallel testing purposes for my automation setup as I have hundreds of test cases to run.
Here's what I have tried.
1) Installed Docker Desktop
2) Downloaded Selenoid containers using this command
docker run -d --name selenoid -p 4444:4444 -v ~/.aerokube/selenoid/:/etc/selenoid/:ro
-v /var/run/docker.sock:/var/run/docker.sock
aerokube/selenoid:latest-release
3) Selenoid and Selenoid UI are up and running on Docker. To check this setup I have done this:
When I type http://localhost:4444/status in my browser it takes me to a page with this text:
{"total":5,"used":0,"queued":0,"pending":0,"browsers":{}}
When I type http://localhost:8080/
in my browser. it takes me to Selenoid UI page with a text No Sessions yet
.
I have a pulled chrome browser image using "docker pull selenoid/chrome" command.
When I try to automate a simple script to access this browser running on Selenoid container I am getting an error
Requested environment is not available (WARNING: The server did not provide any stacktrace information)
DesiredCapabilities dcap = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();
dcap.setCapability(ChromeOptions.CAPABILITY, options);
dcap.setCapability("enableVNC", true);
dcap.setBrowserName("chrome");
RemoteWebDriver driver = new RemoteWebDriver(
URI.create("http://localhost:4444/wd/hub").toURL(),
dcap
);
String driverPath = "C:\\ABC\\chromedriver.exe";
System.setProperty("webdriver.chrome.driver", driverPath);
// Get URL
driver.get("https://www.google.com/");
// Print Title
System.out.println(driver.getTitle());
Am I missing anything important here? Please guide me. Thanks.
You should at least create a browsers.json
file inside ~/.aerokube/selenoid/
where Selenoid will read a list of available browser versions as well as Docker images to be used.
I would recommend you to use our automated installation tool called cm
which will do all your actions above itself. Having this tool binary downloaded to your workstation installation would be as simple as issuing two commands:
$ ./cm selenoid start --vnc
$ ./cm selenoid-ui start