Selenium节点持续离线:桌面-笔记本Grid搭建后节点异常掉线
Hey there, I’ve dealt with this exact problem a few times when setting up Selenium Grid—nodes register successfully but keep dropping offline. Let’s walk through the most likely fixes step by step:
1. Verify Network Connectivity First
This is the #1 culprit for this issue:
- From your laptop (node machine), ping the Hub’s IP (
192.168.0.3). If ping fails, you’ve got a network problem—check if both devices are on the same subnet, or if a firewall is blocking traffic between them. - Reverse the test: ping your laptop’s IP from the Hub machine. Bidirectional connectivity is required for the Grid to work properly.
- Make sure ports
4444(Hub) and5566(node) are open in both devices’ firewalls. For Windows, add inbound/outbound rules for these ports; for Linux, update your iptables or ufw settings.
2. Double-Check the Node Registration URL
Selenium Grid can be picky about URL formatting:
- Try removing the trailing slash from your registration URL. Instead of
http://192.168.0.3:4444/grid/register/, usehttp://192.168.0.3:4444/grid/registerwhen starting the node. - Confirm the Hub is actually running on port 4444: from the Hub machine, open
http://localhost:4444/grid/consolein a browser. Then try accessing the same URL from your laptop—if it doesn’t load, your network is still blocking the connection.
3. Ensure Matching Selenium Server Versions
Even though you’re using 3.9.1 for both, double-check:
- Make sure the
selenium-server-standalone-3.9.1.jarfile is identical on both machines. Sometimes corrupted downloads or mismatched builds can cause silent communication failures. Re-download the jar and replace it on both devices, then restart Hub and node.
4. Dig Into Detailed Logs for Clues
Enable logging to get specific error messages:
- Start the Hub with logging:
java -jar selenium-server-standalone-3.9.1.jar -role hub -log hub.log - Start the node with logging:
java -jar selenium-server-standalone-3.9.1.jar -role webdriver -hub http://192.168.0.3:4444/grid/register -port 5566 -log node.log - Check the
hub.logandnode.logfiles. Common errors likeConnection refused(network block) orInvalid status code 404(wrong registration URL) will point you straight to the problem.
5. Validate Browser Driver Configuration
A misconfigured browser driver can cause the node to fail silently and go offline:
- Ensure your laptop has the correct browser driver (e.g., chromedriver for Chrome, geckodriver for Firefox) installed, and that the driver version matches your browser version.
- Either add the driver’s path to your system’s
PATHenvironment variable, or specify it explicitly when starting the node:# Example for Chrome on Windows java -Dwebdriver.chrome.driver="C:\drivers\chromedriver.exe" -jar selenium-server-standalone-3.9.1.jar -role webdriver -hub http://192.168.0.3:4444/grid/register -port 5566
6. Try a Different Node Port
It’s possible port 5566 is being used by another application on your laptop. Switch to a different port (like 5555) and restart the node:
java -jar selenium-server-standalone-3.9.1.jar -role webdriver -hub http://192.168.0.3:4444/grid/register -port 5555
Start with the network checks—they’re the most common fix here. If that doesn’t work, the logs will give you the exact issue to troubleshoot.
内容的提问来源于stack exchange,提问作者Stephen

