Skip to content

Python Firefox webdriver can fail on slow systems #1300

Closed
@jacekn

Description

@jacekn

When I try to load Firefox webdriver in python using:
webdriver.Firefox()

It occasionally fails after around 30 seconds with below traceback:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 77, in __init__
    self.binary, timeout),
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/extension_connection.py", line 49, in __init__
    self.binary.launch_browser(self.profile)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 68, in launch_browser
    self._wait_until_connectable()
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 103, in _wait_until_connectable
    raise WebDriverException("Can't load the profile. Profile "
selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Profile Dir: %s If you specified a log_file in the FirefoxBinary constructor, check it for details.

I am almost sure it's to do with hardcoded 30 seconds timeout in firefox_binary.py:101. When I changed that value to 60 it started working.

I tried to load webdriver like this:
webdriver.Firefox(timeout=60)

but after looking at the code the timeout is not actually used so made no difference

How to replicate:

  • this issue can only be seen on slow systems (like RaspberryPi) where firefox takes over 30 seconds to start
  • the following python code can be used to replicate the problem:
from selenium import webdriver
browser = webdriver.Firefox()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions