geckodriver icon indicating copy to clipboard operation
geckodriver copied to clipboard

selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service geckodriver

Open ShaolongHu opened this issue 10 years ago • 10 comments

  1. selenium 3.0.0b3
  2. geckodriver-v0.11.1-linux64.tar.gz unpacked to /bin /usr/bin
  3. firefox 48.02
  4. code:

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

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

  1. running:

Traceback (most recent call last): File "test.py", line 3, in browser = webdriver.Firefox() File "/usr/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 68, in init self.service.start() File "/usr/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 92, in start raise WebDriverException("Can not connect to the Service %s" % self.path) selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service geckodriver

Any idea?

Bests,

ShaolongHu avatar Oct 10 '16 14:10 ShaolongHu

Can you please paste the contents of the geckodriver.log file from your current working directory?

andreastt avatar Oct 10 '16 14:10 andreastt

@andreastt

cat geckodriver.log 1476111009361 geckodriver INFO Listening on 127.0.0.1:58451

ShaolongHu avatar Oct 10 '16 14:10 ShaolongHu

I’m not able to reproduce this with selenium-3.0.0b3 off pip. It looks like geckodriver is starting successfully on the port the Python client is requesting it to, and that the client subsequently times out when attempting to connect on that port.

andreastt avatar Oct 10 '16 15:10 andreastt

linking https://github.com/SeleniumHQ/selenium/issues/2903

AutomatedTester avatar Oct 11 '16 21:10 AutomatedTester

Closing this as I cannot reproduce.

andreastt avatar Oct 15 '16 12:10 andreastt

Reproducing for my team, using selenium 3.0.1 on Mac OS Sierra. Tests fail to start with error: Traceback (most recent call last): File "test.py", line 4, in driver = webdriver.Firefox() File "/Users/sbhide/Desktop/virtualenv/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py", line 135, in init self.service.start() File "/Users/username/Desktop/virtualenv/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 92, in start raise WebDriverException("Can not connect to the Service %s" % self.path) selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service geckodriver

Any idea on what the problem might be? Please note that the same happens for chromedriver.

rsuciu-gsg avatar Nov 03 '16 13:11 rsuciu-gsg

If it's happening for multiple drivers it sounds like a selenium issue.

jgraham avatar Nov 03 '16 14:11 jgraham

I'll report this for Selenium, thank you.

rsuciu-gsg avatar Nov 03 '16 14:11 rsuciu-gsg

@dongxiexidian If you had read the actual comments on this issue before commenting, you would have realised this is a Selenium issue.

andreastt avatar Dec 09 '16 02:12 andreastt

windows7 64 python 3.6 selenium 3.6 geckodriver 0.9

I resolved it . remove the comment on hosts file C:\Windows\System32\drivers\etc\hosts 127.0.0.1 localhost

^0^

xxdd10 avatar Oct 24 '17 09:10 xxdd10