简体   繁体   中英

issue with chromedriver.exe with python

I get issues with execution with this code:

from selenium import webdriver
import time
browser = webdriver.Chrome(r'C:\Users\XXXXX\chromedriver.exe') #Path directory
browser.get('https://www.google.com')

The problem is with PATH folder:

SessionNotCreatedException: Message: session not created: This version of 
ChromeDriver only supports Chrome version 101
Current browser version is 100.0.4896.60 with binary path C:\Program 
Files\Google\Chrome\Application\chrome.exe

Any suggestions?

1st issue:

Error

ChromeDriver only supports Chrome version 101

Solution

ChromeDriver and Chrome version have to match. Have a look at the docs . So make sure you have matching versions installed.

2nd issue

Error

'C:\Program Files\Google\Chrome\Application\chromedriver.exe' executable needs to be in PATH

Solution

You need to set PATH variable to include C:\Program Files\Google\Chrome\Application\chromedriver.exe in your operating system ie Windows. The PATH variables defines the paths that your operating system searches for executables. See this thread to see how to set the environment variable in Windows 10. But you can just google for set PATH variable on and you will find plenty of tutorials.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM