You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remote WebDriver fails to execute any command through a Selenium 4.0.0 Standalone Server in Chrome if any other (non IP address) hostname than “localhost” is used for connecting to the Selenium Server.
Having URLs with other names than “localhost” for the host part is a very common scenario in a containerized environment. Using IP addresses ususally is not an option in environments as dynamic as e.g. a Kuberneter cluster.
This issue can be reproduced by running basic remote WebDriver commands against a selenium/standalone-chrome:4.0.0 Docker container.
Given you have Docker installed and you have unpacked the attached selenium.zip file.
Open a shell.
Run docker-compose up -d.
Run docker-compose run client python /selenium4.py.
Traceback (most recent call last):
File "/selenium4.py", line 7, in <module>
driver.get("http://www.google.com")
File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 333, in get
self.execute(Command.GET, {'url': url})
File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 208, in check_response
raise exception_class(value)
selenium.common.exceptions.WebDriverException: Message: Host header or origin header is specified and is not localhost.
For demonstrating that this is not an issue with selenium/standalone-chrome:3.141.59, run: docker-compose run client python /selenium3.py
It should be possible to use URLs like http://selenium4:4444 for connecting to the Selenium Server (i.e. selenium4.py should complete successfully in above scenario).
selenium4.py does complete successfully when being run from the host machine (given Python is installed) with http://localhost:4444, resp. as the Selenium Server URL.
Environment
Browser: Chrome
Browser Version: The one included with selenium/standalone-chrome:4.0.0
Selenium Grid version: 4.0.0
The text was updated successfully, but these errors were encountered:
FixesSeleniumHQ#8326 and fixesSeleniumHQ#7821
ChromeDriver will reject requests if the host header contains something different
than localhost and no whitelistedIps are configured.
This does not affect other drivers.
🐛 Bug Report
Remote WebDriver fails to execute any command through a Selenium 4.0.0 Standalone Server in Chrome if any other (non IP address) hostname than “localhost” is used for connecting to the Selenium Server.
Having URLs with other names than “localhost” for the host part is a very common scenario in a containerized environment. Using IP addresses ususally is not an option in environments as dynamic as e.g. a Kuberneter cluster.
The root cause may be related to this Chromium issue.
Detailed steps to reproduce the behavior:
This issue can be reproduced by running basic remote WebDriver commands against a selenium/standalone-chrome:4.0.0 Docker container.
Given you have Docker installed and you have unpacked the attached
selenium.zip file.
docker-compose up -d
.docker-compose run client python /selenium4.py
.For demonstrating that this is not an issue with selenium/standalone-chrome:3.141.59, run:
docker-compose run client python /selenium3.py
The commands in selenium3.py and selenium4.py are as simple as:
Expected behavior
It should be possible to use URLs like http://selenium4:4444 for connecting to the Selenium Server (i.e. selenium4.py should complete successfully in above scenario).
selenium4.py does complete successfully when being run from the host machine (given Python is installed) with http://localhost:4444, resp. as the Selenium Server URL.
Environment
Browser: Chrome
Browser Version: The one included with selenium/standalone-chrome:4.0.0
Selenium Grid version: 4.0.0
The text was updated successfully, but these errors were encountered: