selenium.common.exceptions.WebDriverException: Message: Service wires unexpectedly exited.

Created on 26 Sep 2016  路  3Comments  路  Source: SeleniumHQ/selenium

Meta -

OS: Ubuntu 16.04
Selenium Version: 2.53.6
Browser: Firefox 49

Expected Behavior -

Following https://github.com/SeleniumHQ/selenium/issues/2739, I understand the problem and tried to fix it by using geckodriver.

I followed this https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver to configure. (I had to rename the executable to wires).

Actual Behavior -

The browser doesn't start.

Traceback (most recent call last):
  File "/usr/lib/python3.5/unittest/loader.py", line 428, in _find_test_path
    module = self._get_module_from_name(name)
  File "/usr/lib/python3.5/unittest/loader.py", line 369, in _get_module_from_name
    __import__(name)
  File "/home/jmaurice/back-office/backoffice/dashboard/tests.py", line 126, in <module>
    d = webdriver.Firefox(capabilities=caps)
  File "/home/jmaurice/back-office/venv/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py", line 65, in __init__
    self.service.start()
  File "/home/jmaurice/back-office/venv/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 86, in start
    self.assert_process_still_running()
  File "/home/jmaurice/back-office/venv/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 99, in assert_process_still_running
    % (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service wires unexpectedly exited. Status code was: 1

Steps to reproduce -

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

caps = DesiredCapabilities.FIREFOX
caps['marionette'] = True
caps['binary'] = '/usr/bin/firefox'
d = webdriver.Firefox(capabilities=caps)

Trying to figure out the problem

I didn't see at first but geckodriver created a log (I renamed 'geckodriver' to 'wires' following the link recommendation).

error: Found argument '--webdriver-port' which wasn't expected, or isn't valid in this context

USAGE: 
    wires --binary <BINARY>

For more information try --help

This led me to # https://github.com/SeleniumHQ/selenium/issues/2544 and https://github.com/SeleniumHQ/selenium/commit/c76917839c868603c9ab494d8aa0e9d600515371, the geckodriver port argument changed from to 'webdriver-port' to 'port', that was edited in version 3 but not in 2.53.

This quick hack seems to do the trick for me, a proper fix is obviously more complicated than that, but that confirms it should be the problem.

    # def command_line_args(self):
    #     if self.firefox_binary:
    #         return ["-b", self.firefox_binary, "--webdriver-port", "%d" % self.port]
    #     return ["--webdriver-port", "%d" % self.port]

    def command_line_args(self):
        if self.firefox_binary:
            return ["-b", self.firefox_binary, "--port", "%d" % self.port]
        return ["--port", "%d" % self.port]

Most helpful comment

Im getting the same error but I'm already using selenium webdriver 3.0.0b3. Is there a step I'm missing? I also used pip install selenium==3.0.0b3 but it seems it was already installed.

All 3 comments

as you saw... it is fixed already. But only available in 3.0.0.b2 and b3. You'll need to upgrade your python library to get those changes. They are available on pypi.

Ok, thanks for the quick reply, I didn't get that 2.53 wasn't patched anymore, but since it's still the default version, maybe it should be explicitly stated that recent versions of firefox are not supported, and that the install command is therefore not pip install selenium but pip install selenium==3.0.0b3.

Im getting the same error but I'm already using selenium webdriver 3.0.0b3. Is there a step I'm missing? I also used pip install selenium==3.0.0b3 but it seems it was already installed.

Was this page helpful?
0 / 5 - 0 ratings