'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?



Solution 1:[1]

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 i. e. 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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mushroomator