Article directory
1. Check the chromedriver version
When using Selenium, you need to download chromedriver
1. First, check that my Chrome browser version has been automatically updated to 116:
2. Find the corresponding chromedriver version: http://chromedriver.storage.googleapis.com/index.html
found that the latest version is only up to 114:
chromedriver does not match the Chrome version and there is no chromedriver that matches the latest Chrome version.
So consider downgrading your Chrome version and disabling automatic updates.
2. Downgrade the Chrome browser and disable automatic updates
1. First uninstall the Chrome browser and related data.
2. Then search for previous versions: https://www.slimjet.com/chrome/google-chrome-old-version.php
The download is complete.
3. Disable automatic update of Chrome browser:
Enter the "Services" panel from the "Start Menu".
Find the Google update service:
Right-click → Properties, change the startup type to "Disabled":
Chrome will no longer automatically update at this time:
Disable update pop-ups:
Right-click Google Chrome → Properties → Add after the target column: --disable-background-networking
Click OK.
Three, chromedriver download configuration
1. Download the chromedriver corresponding to the Chrome browser
2. After decompression, copy chromedriver.exe to the Chrome and Python directories respectively
(1) Under the Chrome directory:
right-click the Google Chrome icon → open the location of the file:
(2) Under the Python directory :
① Find python location: Enter in cmd where python
:
② Copy and paste the chromedriver into the Scripts directory of python:
3. Set environment variables:
Right-click "My Computer" → Properties → Advanced System Settings → Environment Variables,
edit the Path in "User Variables", addC:\Program Files (x86)\Google\Chrome\Application
4. Test
Open the python compiler and write the following code:
from selenium import webdriver
from time import sleep
driver = webdriver.Chrome()
driver.get("http://www.baidu.com")
sleep(2)
driver.quit()
Check the running results:
success!