Python Firefox webdriver can fail on slow systems #1300

Closed
jacekn opened this Issue Nov 21, 2015 · 12 comments

Comments

Projects
None yet
@jacekn

jacekn commented Nov 21, 2015

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()

jacekn pushed a commit to jacekn/selenium that referenced this issue Nov 21, 2015

@jacekn

This comment has been minimized.

Show comment
Hide comment
@jacekn

jacekn Nov 21, 2015

I started working on possible fix here:
https://github.com/jacekn/selenium/commits/issue1300

Note that the above branch is untested and not ready for merge, posting here for reference to help anybody else interested in troubleshooting

jacekn commented Nov 21, 2015

I started working on possible fix here:
https://github.com/jacekn/selenium/commits/issue1300

Note that the above branch is untested and not ready for merge, posting here for reference to help anybody else interested in troubleshooting

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Dec 18, 2015

Seeing the same issue

ghost commented Dec 18, 2015

Seeing the same issue

@willpz

This comment has been minimized.

Show comment
Hide comment
@willpz

willpz Jan 3, 2016

I am getting this error everytime I start FF with this command: "browser = webdriver.Firefox()" , even if I change this hardcoded timeout value to a bigger number (in my test was 100s).
Test environment:

  • Raspberry Pi model B running Raspbian Wheezy
  • python 2.7 or python 3.2
  • Selenium 2.48
  • Iceweasel 38.4.0

willpz commented Jan 3, 2016

I am getting this error everytime I start FF with this command: "browser = webdriver.Firefox()" , even if I change this hardcoded timeout value to a bigger number (in my test was 100s).
Test environment:

  • Raspberry Pi model B running Raspbian Wheezy
  • python 2.7 or python 3.2
  • Selenium 2.48
  • Iceweasel 38.4.0

jacekn added a commit to jacekn/selenium that referenced this issue Jan 7, 2016

@samsun387

This comment has been minimized.

Show comment
Hide comment
@samsun387

samsun387 Jan 19, 2016

Seeing the exact same issue..

Seeing the exact same issue..

@peletiah

This comment has been minimized.

Show comment
Hide comment
@peletiah

peletiah Aug 2, 2016

Issue does not seem to be caused by a slow machine. I'm running into the same problem with an i5-4570T.

peletiah commented Aug 2, 2016

Issue does not seem to be caused by a slow machine. I'm running into the same problem with an i5-4570T.

@willa75

This comment has been minimized.

Show comment
Hide comment
@willa75

willa75 Sep 4, 2016

Sorry, if this has been asked elsewhere, but is there a way to temporarily work around this issue?

willa75 commented Sep 4, 2016

Sorry, if this has been asked elsewhere, but is there a way to temporarily work around this issue?

@agude

This comment has been minimized.

Show comment
Hide comment
@agude

agude Sep 7, 2016

@willa75 The only way I know is to apply the patch yourself to where ever the code resides on your system.

The simplest workaround is to change this hardcoded value (count == 30) to something higher:

This is the solution I used until the patch was merged.

agude commented Sep 7, 2016

@willa75 The only way I know is to apply the patch yourself to where ever the code resides on your system.

The simplest workaround is to change this hardcoded value (count == 30) to something higher:

This is the solution I used until the patch was merged.

@willa75

This comment has been minimized.

Show comment
Hide comment
@willa75

willa75 Sep 13, 2016

Thanks @agude but even after I hardcoded the value to 120 I still got the error, I will probably just have to wait for the issue to be resolved or use Chrome only for testing at the moment. Thanks for the help!

willa75 commented Sep 13, 2016

Thanks @agude but even after I hardcoded the value to 120 I still got the error, I will probably just have to wait for the issue to be resolved or use Chrome only for testing at the moment. Thanks for the help!

@scttech1967

This comment has been minimized.

Show comment
Hide comment
@scttech1967

scttech1967 Sep 16, 2016

Please make sure to update this ticket when the issue is resolved. I'm having the same problem with the WebDriverException: Message: Can't load the profile. Thank you!!

Please make sure to update this ticket when the issue is resolved. I'm having the same problem with the WebDriverException: Message: Can't load the profile. Thank you!!

@JivanAmara

This comment has been minimized.

Show comment
Hide comment
@JivanAmara

JivanAmara Sep 29, 2016

Getting the same behaviour as @willa75. It's not a slow machine & changing the timeout to 120 doesn't change the error. Happy to test potential fixes.

Getting the same behaviour as @willa75. It's not a slow machine & changing the timeout to 120 doesn't change the error. Happy to test potential fixes.

@Bea-code

This comment has been minimized.

Show comment
Hide comment
@Bea-code

Bea-code Oct 18, 2016

I am getting the same error after a Firefox update 48.0.2 was working fine. Is there are fix for this that can be used while running the code without changing the waiting time?

I am getting the same error after a Firefox update 48.0.2 was working fine. Is there are fix for this that can be used while running the code without changing the waiting time?

@HackToday

This comment has been minimized.

Show comment
Hide comment
@HackToday

HackToday Nov 1, 2016

I am using selenium 2.53.1 and Firefox 45.0。2, can hit above issue occasionally

I am using selenium 2.53.1 and Firefox 45.0。2, can hit above issue occasionally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment