Selenoid is a powerful and lightweight tool for running Selenium tests in Docker containers. It provides an easy way to run multiple browsers, with different versions and configurations, on a single machine or cluster.
In this tutorial, we will walk you through the steps to install Selenoid on MXLinux Latest.
To install Selenoid, you need to download the configuration files from the Selenoid repository. Open a terminal window and run the following command:
$ curl -s https://aerokube.com/cm/bash | bash \
&& ./cm selenoid start \
--vnc \
--tmpfs 128 \
--args "-limit 20 -service-startup-timeout 60s"
This command will download the Selenoid configuration files and start the Selenoid server with the following options:
--vnc
: enables VNC support for the browsers, which allows you to see the tests running in real-time.--tmpfs 128
: allocates 128MB of RAM to the temporary file system, which improves performance.--args "-limit 20 -service-startup-timeout 60s"
: sets the maximum number of browsers that can run simultaneously to 20 and the service startup timeout to 60 seconds.After the files are downloaded, you will see a message indicating that the Selenoid server has started:
Selenoid has been started
To verify that Selenoid is running correctly, open the following URL in your browser:
http://localhost:4444/status
You should see a JSON response containing information about the Selenoid server:
{
"total": 0,
"used": 0,
"queued": 0,
"pending": 0,
"browsers": {}
}
This indicates that the server is running correctly and there are currently no tests running.
To run a test using Selenoid, you need to create a script that uses the Selenium WebDriver API to interact with a browser. Here's an example script that opens the Google homepage and searches for the keyword "Selenoid":
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Remote(
command_executor="http://localhost:4444/wd/hub",
desired_capabilities={
"browserName": "chrome",
"browserVersion": "latest",
"selenoid:options": {
"enableVNC": True,
"enableVideo": False
}
}
)
driver.get("http://www.google.com")
input_el = driver.find_element_by_name("q")
input_el.send_keys("Selenoid")
input_el.send_keys(Keys.RETURN)
driver.quit()
Save this script to a file named test.py
and then run the following command to execute the test:
$ python test.py
You should see a Chrome browser window open and navigate to the Google homepage. After a few seconds, the search results for "Selenoid" will appear.
Congratulations! You have successfully installed Selenoid on MXLinux Latest and run a Selenium test using the Selenoid server. This powerful tool makes it easy to run tests on multiple browsers with different configurations and versions, all on a single machine or cluster. Happy testing!
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!