Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: selenium.common.exceptions.WebDriverException: Message: Host header doesn't match server localhost:60955 #10065

Closed
DEADF00D opened this issue Nov 20, 2021 · 4 comments

Comments

@DEADF00D
Copy link

DEADF00D commented Nov 20, 2021

What happened?

Running the python program give a direct exception:

Traceback (most recent call last):
  File "/home/deadf00d/Documents/RedditBot/bot.py", line 3, in <module>
    driver = webdriver.Firefox()
  File "/usr/lib/python3.9/site-packages/selenium/webdriver/firefox/webdriver.py", line 180, in __init__
    RemoteWebDriver.__init__(
  File "/usr/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 266, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 357, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 420, in execute
    self.error_handler.check_response(response)
  File "/usr/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 244, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Host header doesn't match server localhost:60955

How can we reproduce the issue?

from selenium import webdriver

driver = webdriver.Firefox()
driver.get("https://dev.to")

Relevant log output

NaN

Operating System

Linux deadf00d 5.14.14-arch1-1 #1 SMP PREEMPT Wed, 20 Oct 2021 21:35:18 +0000 x86_64 GNU/Linux

Selenium version

Python - Selenium 4.0.0

What are the browser(s) and version(s) where you see this issue?

Firefox 93.0 (64 bit)

What are the browser driver(s) and version(s) where you see this issue?

geckodriver 0.30.0 (d372710b98a6 2021-09-16 10:29 +0300)

Are you using Selenium Grid?

No (i guess)

@github-actions
Copy link

@DEADF00D, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@lodrantl
Copy link

lodrantl commented Nov 20, 2021

Encountered the same problem on Arch. I don't think it is a Selenium problem but more of a geckodriver problem. I looks like it has something to do with localhost resolving to both IPv6 and IPv4 address while geckodriver is only bound to IPv4.

I found two possible fixes:

  1. disable IPv6 completely
  2. add the standard localhost config to /etc/hosts (no idea why it works)
127.0.0.1        localhost
::1              localhost

@DEADF00D
Copy link
Author

It does work indeed !
Thank you very much.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants