-2

I want to run my python selenium scripts in chrome browser on windows. I downloaded chrome driver and placed the exe file in "C:\Python27\Scripts" but still I'm getting error as

Traceback (most recent call last):
  File "C:\Users\INNOVATE\Desktop\workspace\Sample\sample.py", line 3, in <module>
    driver = webdriver.Chrome()
  File "C:\Python27\lib\site-packages\selenium-2.44.0-py2.7.egg\selenium\webdriver\chrome\webdriver.py", line 59, in __init__
    self.service.start()
  File "C:\Python27\lib\site-packages\selenium-2.44.0-py2.7.egg\selenium\webdriver\chrome\service.py", line 66, in start
    "ChromeDriver executable needs to be available in the path. "
selenium.common.exceptions.WebDriverException: Message: ChromeDriver executable needs to be available in the path. Please download from http://chromedriver.storage.googleapis.com/index.html and read up at http://code.google.com/p/selenium/wiki/ChromeDriver

what should I do?

fredtantini
  • 15,966
  • 8
  • 49
  • 55
Geetha
  • 11
  • 1
  • 2
  • 3
    Have you read the error message? Especially the part that says *ChromeDriver executable needs to be available in the path* and provides URLs to download that module? – Frédéric Hamidi Dec 11 '14 at 10:36
  • Check this link for setting up ChromeDriver in python: [http://stackoverflow.com/a/8259152/4193730](http://stackoverflow.com/a/8259152/4193730) – Subh Dec 11 '14 at 11:34

2 Answers2

1

try this package.

from selenium import webdriver
import chromedriver_autoinstaller

chromedriver_autoinstaller.install()

#maximize the chrome
chrome_options = Options()
chrome_options.add_argument("--start-maximized")

driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get("https://www.google.com")

you can defiantly remove chrome_options or add more arguments.

Please see the documentation, https://pypi.org/project/chromedriver-autoinstaller/

kmpatel100
  • 108
  • 5
0

Please make sure you have performed all the required steps to open Chrome using Selenium.

Step1: Download Chrome Driver Latest Release of Chrome Driver you can found is ChromeDriver 2.13. Please use Link Chrome Driver to get the latest one.

Step2: Save the Chrome Driver to your Project Location and give the path of that folder in your code. In my case i have saved the Chrome Driver in 'S' drive.

System.setProperty("webdriver.chrome.driver","S://Chrome Driver//chromedriver.exe");

Please check the path again where i believe is the problem in your code.

Rupesh Shinde
  • 1,933
  • 12
  • 22