I\'m having trouble using the Chrome driver for Selenium. I have the chromedriver downloaded and saved to C:\\Chrome:
driver = webdriver.Chrome(executable_pa
Just place the chromedriver.exe in your python folder (in my case: C:\Python27) and use the below mentioned code it will work for you guys
driver = webdriver.Chrome()
driver.maximize_window()
driver.get("URL")
For Linux
1. Check you have installed latest version of chrome browser-> "chromium-browser -version"
2. If not, install latest version of chrome "sudo apt-get install chromium-browser"
3. Get the appropriate version of chrome driver from http://chromedriver.storage.googleapis.com/index.html
4. Unzip the chromedriver.zip
5. Move the file to /usr/bin directory sudo mv chromedriver /usr/bin
6. Goto /usr/bin directory and you would need to run something like "chmod a+x chromedriver" to mark it executable.
7. finally you can execute the code.
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("http://www.google.com")
display.stop()
You should specify the executable file path, not the directory path that contains the executable.
driver = webdriver.Chrome(executable_path=r"C:\Chrome\chromedriver.exe")
This code doesn't need path to drive file:
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
import os
from selenium import webdriver
chromedriver = "C://chromedriver.exe"
os.environ["webdriver.chrome.driver"] = chromedriver
driver =webdriver.Chrome(chromedriver)
For Debian/Ubuntu - it works:
install Google Chrome for Debian/Ubuntu:
sudo apt-get install libxss1 libappindicator1 libindicator7
wget https://dl.google.com/linux/direct/google-chrome-
stable_current_amd64.deb
sudo dpkg -i google-chrome*.deb
sudo apt-get install -f
Install ChromeDriver:
wget -N http://chromedriver.storage.googleapis.com/2.26/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
chmod +x chromedriver
sudo mv -f chromedriver /usr/local/share/chromedriver
sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
sudo ln -s /usr/local/share/chromedriver /usr/bin/chromedriver
Install Selenium:
pip install -U selenium
Selenium in Python:
from selenium import webdriver
driver = webdriver.Chrome()
driver.get('https://www.google.co.in/')