0

Unable to launch browser through selenium. Everything worked fine for a few months before. I did not find a solution on the Internet.

>>> from selenium import webdriver
>>> options = webdriver.FirefoxOptions()
>>> options.add_argument('--no-sandbox')
>>> options.add_argument('--headless')
>>> options.add_argument('--disable-dev-shm-usage')
>>> browser = webdriver.Firefox(options=options, executable_path='path to geckodriver')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/python/venv/lib/python3.8/site-packages/selenium/webdriver/firefox/webdriver.py", line 170, in __init__
    RemoteWebDriver.__init__(
  File "/root/python/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/root/python/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/root/python/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/root/python/venv/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: Connection refused (os error 111)

Please help me solve my problem.

  • 1
    Could this help your query? [SO archive link](https://stackoverflow.com/questions/52474999/how-to-fix-python-selenium-error-connection-refused-when-initializing-a-seleni) – Anand Gautam Jan 31 '22 at 09:23
  • Thank you. Versions of firefox, selenium and driver are the latest. Problem solved with proc.kill(), but I think there is a better solution. It's better than nothing but proc.kill() is workaround. – Matvii Kurdiukov Feb 01 '22 at 14:20

0 Answers0