Python Selenium Chrome Webdriver
Here's a simpler solution: install python-chromedrive package, import it in your script, and it's 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()
driver.get("http://www.python.org")
Reference: https://pypi.org/project/chromedriver-binary/
You need to specify the path where your chromedriver is located.
Download chromedriver for your desired platform from here.
Place chromedriver on your system path, or where your code is.
If not using a system path, link your
chromedriver.exe
(For non-Windows users, it's just calledchromedriver
):browser = webdriver.Chrome(executable_path=r"C:\path\to\chromedriver.exe")
(Set
executable_path
to the location where your chromedriver is located.)If you've placed chromedriver on your System Path, you can shortcut by just doing the following:
browser = webdriver.Chrome()
If you're 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
That's all. If you're still experiencing issues, more info can be found on this other StackOverflow article: Can't use chrome driver for Selenium