Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Chrome to launch via Selenium

Tags:

I am having issues getting an instance of a Chrome browser from selenium in python. I'm using Windows 8. I have downloaded the chromedriver binary and added it to my path but I get the following error in Python:

selenium.common.exceptions.WebDriverException: Message: 'ChromeDriver executable needs to be available in the path.   

This error occurs for the following line:

driver = webdriver.Chrome(executable_path='path\to\chromedriver_win32_2.0')  
like image 243
haran kumar Avatar asked Jul 02 '13 22:07

haran kumar


People also ask

Can Google Chrome be supported by Selenium?

Through WebDriver, Selenium supports all major browsers on the market such as Chrome/Chromium, Firefox, Internet Explorer, Edge, and Safari.

How do I add Chrome to Selenium?

Below are the steps to follow while configuring the chrome setup for Selenium. #1) Check the version of the chrome. #3) Download the chromedriver.exe file for the respective OS and copy that .exe file into your local. #4) The path of the chromedriver (C:\webdriver\chromedriver.exe) will be used in our program.


1 Answers

Two ways to set it, you somehow mixed up.

  • Put the chromedriver.exe's path into PATH (on Windows), so your PATH setting is correct, but you need to call the default constructor.

    driver = webdriver.Chrome()

  • Specify the path in webdriver.Chrome(executable_path='some path'). Here you need the full path to the executable, not the directory.

    webdriver.Chrome(executable_path=r'C:\Users\HaranKumar\Downloads\chromedriver_win32_2.0\chromedriver.exe')

Choose either one you want.

like image 75
Yi Zeng Avatar answered Oct 19 '22 00:10

Yi Zeng