0
  • Firefox version: 60.9.0esr (32-bit)
  • Selenium version: 3.141.0
  • Geckodriver version: 0.24.0 (32-bit)

So everything currently works in non-headless mode. But I need to run this python script in a GUI-less linux server (thus need headless mode). For some reason, all my attempts to run headlessly results in selenium web driver timing out on initialization.

        from selenium import webdriver

        geckoDriverFilepath = path + "geckodriver24_32.exe"

        opts = webdriver.FirefoxOptions()
        opts.add_argument("--headless")
        opts.add_argument("--width=2560")
        opts.add_argument("--height=1440")

        #initialize driver (breaks/timeouts here)
        driver = webdriver.Firefox(options=opts,executable_path=geckoDriverFilepath)

The following is the Traceback:

File "c:\Users\xUser\Desktop\BOMWebService\Backend\code\FirefoxStarter.py", line 51, in StartFirefox driver = webdriver.Firefox(options=opts,executable_path=geckoDriverFilepath)

File "C:\Users\xUser\Desktop\BOMWebService\Backend\virEnvBOMBackend\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 174, in init keep_alive=True)

File "C:\Users\xUser\Desktop\BOMWebService\Backend\virEnvBOMBackend\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in init self.start_session(capabilities, browser_profile)

File "C:\Users\xUser\Desktop\BOMWebService\Backend\virEnvBOMBackend\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters)

File "C:\Users\xUser\Desktop\BOMWebService\Backend\virEnvBOMBackend\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute self.error_handler.check_response(response)

File "C:\Users\xUser\Desktop\BOMWebService\Backend\virEnvBOMBackend\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace)

selenium.common.exceptions.WebDriverException: Message: timed out

Any pointers would be much appreciated. Thanks!

1
  • That's a pretty old version of firefox (and I don't know that the geckodriver is the corresponding driver). Is there a reason that you don't want to use current version? And you say you want to run on linux, but your stacktrace is for Windows... Commented Nov 20, 2019 at 1:03

1 Answer 1

0

This error message...

selenium.common.exceptions.WebDriverException: Message: timed out

...implies that the GeckoDriver was unable to initiate/spawn a new WebBrowser i.e. Firefox Browser session.

Your main issue is the incompatibility between the version of the binaries you are using as follows:

  • Your Selenium Client version is 3.141.0 which is almost a bit older.
  • Your GeckoDriver version is v0.24.0.
  • Your Firefox version is v60.9.0esr.

So there is a clear mismatch between Selenium Client v3.141.0 , GeckoDriver v0.24.0 and the Firefox Browser v60.9.0esr


Solution

  • Upgrade Selenium to current levels Version 3.141.59.
  • Upgrade GeckoDriver to GeckoDriver v0.26.0 level.
  • GeckoDriver is present in the desired location.
  • GeckoDriver is having executable permission for non-root users.
  • Upgrade Firefox version to Firefox v70.0 levels.
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
  • Take a System Reboot.
  • Execute your Test as a non-root user.
  • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.

Here you can find a detailed discussion on Which Firefox browser versions supported for given Geckodriver version?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.