Configure Headless Chrome Cluster with Selenoid on VPS: Large-Scale Automation Test Solution to Optimize Costs
Detailed guide to configure a headless Chrome cluster with Selenoid on VPS for large-scale automation testing with optimized costs. Covers installation, configuration, testing, and...
Image credit: jaygeorge · Pixabay Content License
In the fast-paced world of software development, automation testing has become a critical factor in ensuring product quality. With the need to test across multiple browsers, devices, and versions, using a headless Chrome cluster combined with Selenoid on a VPS offers an effective solution to scale automated testing at low cost. This guide walks you through setting up a headless Chrome cluster using Selenoid on a VPS, ideal for projects requiring large-scale automated testing.
1. Introduction to Selenoid and Headless Chrome
Selenoid is an open-source service that enables you to run Selenium sessions across multiple browsers and devices efficiently, particularly suited for automation environments. With headless mode, Chrome operates without a graphical user interface, saving system resources and improving processing speed.
Deploying Selenoid on a VPS allows you to test multiple browsers simultaneously, scaling your testing capabilities without investing in physical hardware. This solution is ideal for development teams, QA departments, or businesses needing large-scale automated testing at minimal cost.
2. Requirements and Preparation
To deploy a headless Chrome cluster with Selenoid, you will need:
- VPS with at least 8GB RAM and 2 vCPU (recommended: 16GB RAM for large-scale testing)
- Operating System: Ubuntu 20.04 or 22.04
- Docker and Docker Compose installed
- Stable internet connection
3. Configure and Deploy Selenoid
We will use Docker Compose to deploy Selenoid and the required browsers.
3.1. Create docker-compose.yml File
Create a docker-compose.yml file with the following content:
version: '3.7'
services:
selenoid:
image: selenoid/vnc:latest
container_name: selenoid
ports:
- "4444:4444"
volumes:
- ./video:/opt/selenoid/video
- ./logs:/opt/selenoid/logs
- ./browsers:/opt/selenoid/browsers
- ./config:/opt/selenoid/config
environment:
- Selenoid_Container_Registry=selenoid/vnc:latest
- Selenoid_Container_Registry_Prefix=selenoid
- Selenoid_Container_Registry_Enabled=true
- Selenoid_Container_Registry_Video=true
- Selenoid_Container_Registry_Headless=true
restart: always
selenoid-ui:
image: selenoid/ui:latest
container_name: selenoid-ui
ports:
- "8080:8080"
depends_on:
- selenoid
restart: always
3.2. Create Configuration Folders
Create the configuration directories for Selenoid:
mkdir -p ./config
mkdir -p ./browsers
mkdir -p ./logs
mkdir -p ./video
3.3. Configure config.json File
Create a config.json file in the config folder:
{
"selenoid": {
"version": "1.14.1",
"image": "selenoid/vnc:latest"
},
"browsers": {
"chrome": {
"default": "115.0",
"versions": {
"115.0": {
"image": "selenoid/chrome:115.0",
"port": "4444",
"path": "/"
}
}
},
"firefox": {
"default": "115.0",
"versions": {
"115.0": {
"image": "selenoid/firefox:115.0",
"port": "4444",
"path": "/"
}
}
}
}
}
4. Start the Cluster
Run the following command to start the cluster:
docker-compose up -d
Once started, access http:// to check the Selenoid UI status.
5. Test and Optimize Performance
To test performance, run a simple Selenium script to verify headless Chrome sessions:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--disable-dev-shm-usage")
driver = webdriver.Remote(
command_executor='http://:4444/wd/hub',
options=chrome_options
)
driver.get("https://www.google.com")
print(driver.title)
driver.quit()
6. Optimize Costs and Scale
- Choose a VPS with more than 16GB RAM to support multiple concurrent sessions.
- Implement auto-scaling by deploying multiple VPS instances connected to the Selenoid cluster.
- Monitor system resources and adjust the number of browsers running in parallel.
7. Troubleshooting
- If you cannot connect to port
4444, check the VPS firewall and port forwarding settings. - Check error logs in the
./logsdirectory. - Ensure Docker Compose is installed in the correct version.
8. References
- Self-Host FileStash on Docker VPS
- High-RAM Cloud VPS for Self-Hosted LLMs & API Gateways
- Dedicated Compute Servers for AI & Inference Workloads
Deploying a headless Chrome cluster with Selenoid on a VPS enables large-scale automated testing at optimized costs. With flexible configuration and scalability, this solution suits organizations requiring fast and efficient testing.
High-RAM Cloud VPS Plans Optimized for AI, Databases & Cache
Enterprise RAID 10 NVMe SSDs, CMC & FPT District 9 uplinks with Anycast Anti-DDoS and 99.99% SLA.
VPS-4E
10% VAT included
- CPU: 4 vCPU
- RAM: 8 GB
- SSD: 50 GB NVMe
