Selenium_webdriver calls chrome driver

Source: Internet
Author: User

Today, we are using selenium + WebDriver to open chrome. The Code is as follows:

From selenium import WebDriver

Driver = WebDriver. Chrome ()

Driver. Get ("www.google.com ")

After running the code, the following error occurs:

Traceback (most recent call last ):
File "/selenium_python/forward_url.py", line 7, in <module>
Driver = WebDriver. Chrome ()
File "/usr/local/lib/python2.7/dist-packages/selenium/WebDriver/Chrome/WebDriver. py", line 60, in _ init __
Self. Service. Start ()
File "/usr/local/lib/python2.7/dist-packages/selenium/WebDriver/Chrome/service. py", line 68, in start
And read up at http://code.google.com/p/selenium/wiki/ChromeDriver ")
Selenium. Common. Exceptions. webdriverexception: Message: 'chromedriver executable needs to be available in the path. Please download from http://code.google.com/p/selenium/downloads/list and read up at http://code.google.com/p/selenium/wiki/chromedriver'

If the prompt chrome driver is not placed in the correct path, download chrome dirver and place it in the/usr/bin directory. Then, run it again!

OS Expected location of chrome
Linux /Usr/bin/google-chrome1
Mac /Applications/Google \ chrome. APP/contents/MACOs/Google \ chrome
Windows XP % Homepath % \ Local Settings \ Application Data \ google \ chrome \ Application \ chrome.exe
Windows Vista C: \ Users \ % username % \ appdata \ Local \ google \ chrome \ Application \ chrome.exe

This table indicates that Google-chrome should be placed in the/usr/bin directory under Ubuntu.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.