Selenium (Python) WebDriverException with Chrome browser on Ubuntu

2,393 views
Skip to first unread message

ming

unread,
Apr 8, 2016, 10:25:56 AM4/8/16
to Selenium Users
Hi,
i've a bunch of Python Selenium scripts which have been running fine for years with Firefox.  However, when i replaced Firefox with Chrome this morning, i ran into the following exception
   ...
   WebDriverException: Message: Can not connect to the Service /opt/google/chrome/google-chrome
from a trivial Selenium script on Ubuntu.  The Chrome browser did come up but then the exception was thrown.

It's not clear to me what went awry though:

[code snippet]
   ...
   driver = webdriver.Chrome(executable_path="/opt/google/chrome/google-chrome")
   ...

The output of "file /opt/google/chrome/google-chrome" is:

   /opt/google/chrome/google-chrome: ELF 64-bit LSB shared object, x86-64,
   version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2,
   for GNU/Linux 2.6.26, BuildID[sha1]=6b766636ccc2748536dbd66ecc3ab46dd7957068, stripped

The pertinent versions are:
* Ubuntu    15.10
* Python    2.7.10
* Selenium  2.53.1
* Chrome    Version 49.0.2623.110 unknown (64-bit) 

Any idea at a quick glance?

Thanks for reading.

Krishnan mahadevan

unread,
Apr 8, 2016, 10:39:31 AM4/8/16
to seleniu...@googlegroups.com
Have you made the chromedriver available in your PATH variable ?

-Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else"

From: ming
Sent: ‎08-‎04-‎2016 19:56
To: Selenium Users
Subject: [selenium-users] Selenium (Python) WebDriverException with Chromebrowser on Ubuntu

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/f19d6d46-319c-4e39-aa2f-403ef9102bd1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hseu-Ming Chen

unread,
Apr 8, 2016, 10:57:24 AM4/8/16
to seleniu...@googlegroups.com
> Have you made the chromedriver available in your PATH variable ?

Yes, i did but to no avail:
   sys.path.append("/opt/google/chrome")

Moreover, in /usr/bin, i also established symlinks for
    chrome
    google-chrome
(from /opt/google/chrome) but that does not help either

The output of "ls /opt/google/chrome" appears to be correct:

chrome                           default-app-block         nacl_helper            product_logo_22.png   resources.pak
chrome_100_percent.pak           default_apps              nacl_helper_bootstrap  product_logo_24.png   snapshot_blob.bin
chrome_200_percent.pak           google-chrome             nacl_irt_x86_64.nexe   product_logo_256.png  xdg-mime
chrome_material_100_percent.pak  icudtl.dat                natives_blob.bin       product_logo_32.png   xdg-settings
chrome_material_200_percent.pak  libwidevinecdmadapter.so  PepperFlash            product_logo_32.xpm
chrome-sandbox                   libwidevinecdm.so         product_logo_128.png   product_logo_48.png
cron                             locales                   product_logo_16.png    product_logo_64.png

Thanks.


--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/yBtENtXXgHU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.

To post to this group, send email to seleniu...@googlegroups.com.

Krishnan mahadevan

unread,
Apr 8, 2016, 11:02:07 AM4/8/16
to seleniu...@googlegroups.com
Am not talking about the browser binary. I am referring to the chromedriver binary that is additional required apart from the browser binary. Just thought I would be explicit about that.

Firefox doesn't need anything apart from the browser binary.

Chrome requires an additional server binary

-Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else"

From: Hseu-Ming Chen
Sent: ‎08-‎04-‎2016 20:27
To: seleniu...@googlegroups.com
Subject: Re: [selenium-users] Selenium (Python) WebDriverException withChromebrowser on Ubuntu

Hseu-Ming Chen

unread,
Apr 8, 2016, 12:06:00 PM4/8/16
to seleniu...@googlegroups.com
> I am referring to the chromedriver binary that is additional required apart from the browser binary.

Thanks for pointing that out.   i just kind of rushed to simply replace FF with Chrome ...  my bad.

However, i now ran into a different exception ("Chrome failed to start: crashed") after i downloaded ChromeDriver 2.21 from https://sites.google.com/a/chromium.org/chromedriver/ and put it in /usr/bin

[code snippet]
    ...
    driver = webdriver.Chrome(executable_path='/usr/bin/chromedriver')

The output of "file /usr/bin/chromedriver" is:
    /usr/bin/chromedriver: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked,
    interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.26,
    BuildID[sha1]=86747d6354b01d908c3bda349727e74a9da3eb13, stripped

[program output]
Traceback (most recent call last):
  File "./t.py", line 9, in <module>
    driver = webdriver.Chrome(executable_path='/usr/bin/chromedriver')  # Optional argument, if not specified will search path.
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 67, in __init__
    desired_capabilities=desired_capabilities)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 91, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 173, in start_session
    'desiredCapabilities': desired_capabilities,
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 233, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed
  (Driver info: chromedriver=2.21.371461 (633e689b520b25f3e264a2ede6b74ccc23cb636a),platform=Linux 4.2.0-35-generic x86_64)

Is this due to some kind of incompatibility?    If so, is there a compatibility matrix somewhere that i can reference?








Krishnan mahadevan

unread,
Apr 8, 2016, 12:14:50 PM4/8/16
to seleniu...@googlegroups.com
For chrome there is no such matrix that I am aware of.

Usually it's always the latest version of both the browser and the driver that does the trick.

Since I haven't worked with a Linux machine I am out of ideas on what could be causing the browser crash.

-Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else"

From: Hseu-Ming Chen
Sent: ‎08-‎04-‎2016 21:35

Hseu-Ming Chen

unread,
Apr 8, 2016, 12:20:26 PM4/8/16
to seleniu...@googlegroups.com
> Usually it's always the latest version of both the browser and the driver that does the trick.

While troubleshooting the problem this morning, i already upgraded my Chrome to the latest.   i later downloaded the __latest__ ChromeDriver from Google (for Linux 64-bit that is).

Anyway, thanks a lot for your input.



Reply all
Reply to author
Forward
0 new messages