'Selenium.WebDriverException: Message: unknown error: net::ERR_NAME_NOT_RESOLVED
I am trying to user latest selenium hub in docker and try to run pytests in docker or without it for debug. I set up selenium according to official documentation. I used 3 version for docker compose: https://github.com/SeleniumHQ/docker-selenium/blob/trunk/docker-compose-v3.yml
Also health check is ok:
{
"value": {
"ready": true,
"message": "Selenium Grid ready.",
"nodes": [
{
"id": "9b050c95-76e1-4ed3-be7e-a320630fdf1e",
"uri": "http:\u002f\u002f192.168.32.4:5555",
"maxSessions": 8,
"stereotypes": [
{
"capabilities": {
"browserName": "chrome"
},
"count": 8
}
],
"sessions": [
]
},
{
"id": "d4e6d3a1-140d-41c9-b9c6-38fd5b6677b5",
"uri": "http:\u002f\u002f192.168.32.5:5555",
"maxSessions": 8,
"stereotypes": [
{
"capabilities": {
"browserName": "firefox"
},
"count": 8
}
],
"sessions": [
]
}
]
}
}
I am trying to start tests via pycharm (not in docker) on localhost:4444 and receive next error:
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7fe353e9c0d0>
response = {'status': 500, 'value': '{"value":{"error":"unknown error","message":"unknown error: net::ERR_NAME_NOT_RESOLVED\\n (Session info: chrome=85.0.4183.83)","stacktrace":"#0 0x56398a84caa9 \\u003Cunknown>\\n"}}'}
Browser version for chrome is 85.0.4183.83 I start browser in conftest.py:
browser = webdriver.Remote(
command_executor=f"http://{os.environ['SE_EVENT_BUS_HOST']}:4444/wd/hub",
desired_capabilities={
'browserName': browser_name
}
)
I tried to set localhost there as well as selenium-hub. In docker compose I also added pytests section to try set up tests in docker:
pytests:
container_name: selenium_pytests
# network_mode: host
command: /bin/sleep infinity
build: .
environment:
- SE_EVENT_BUS_HOST=selenium-hub
volumes:
- ./reports:/opt/app/reports
While running pytests in docker I do not see hub. Trying to check by selenium-hub and localhost as well:

My wait-for-it.sh:
#!/bin/bash
# wait-for-grid.sh
set -e
cmd="$@"
while ! curl -sSL "http://selenium-hub:4444/wd/hub/status" 2>&1 \
| jq -r '.value.ready' 2>&1 | grep "true" >/dev/null; do
echo 'Waiting for the Grid'
sleep 1
done
>&2 echo "Selenium Grid is up - executing tests"
Tried curl there: localhost, selenium-hub.
Previously I was using environment HUB_HOST=hub. That works for me for running tests in docker but I got same error ERR_NAME_NOT_RESOLVED for running tests out of docker.
Solution 1:[1]
Please try running docker selenium hub with mode:global also instead of using hub try with HUB_HOST=selenium-hub once.
Chart working for me
version: "3.6"
services:
selenium-hub:
restart: always
image: selenium/hub:3.14.0
container_name: selenium-hub
ports:
- "4444:4444"
chrome:
restart: always
image: selenium/node-chrome-debug:3.14.0
ports:
- "5900-5999:5900"
depends_on:
- selenium-hub
environment:
HUB_HOST: selenium-hub
HUB_PORT_4444_TCP_ADDR: selenium-hub
HUB_PORT_4444_TCP_PORT: 4444
DBUS_SESSION_BUS_ADDRESS: "/dev/null"
links:
- selenium-hub:hub
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |

