Python Selenium Chrome Webdriver

Python Selenium Chrome Webdriver

You need to specify the path where your chromedriver is located.

  1. Download chromedriver for your desired platform from here.
  2. Place chromedriver on your system path, or where your code is.
  3. If not using a system path, link your chromedriver.exe (For non-Windows users, its just called chromedriver):
    browser = webdriver.Chrome(executable_path=rC:pathtochromedriver.exe)

    (Set executable_path to the location where your chromedriver is located.)

    If youve placed chromedriver on your System Path, you can shortcut by just doing the following:

    browser = webdriver.Chrome()

  4. If youre running on a Unix-based operating system, you may need to update the permissions of chromedriver after downloading it in order to make it executable:

    chmod +x chromedriver

  5. Thats all. If youre still experiencing issues, more info can be found on this other StackOverflow article: Cant use chrome driver for Selenium

Heres a simpler solution: install python-chromedrive package, import it in your script, and its done.

Step by step:
1. pip install chromedriver-binary
2. import the package

from selenium import webdriver
import chromedriver_binary  # Adds chromedriver binary to path

driver = webdriver.Chrome()


Python Selenium Chrome Webdriver

Leave a Reply

Your email address will not be published. Required fields are marked *