编写一个简单的Selenium脚本来点击网站上的链接。 脚本的编写方式如下:
from selenium import webdriver
import time
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
browser = webdriver.Chrome(options=chrome_options)
try:
browser.get("https://www.google.com")
print("Page title was '{}'".format(browser.title))
finally:
browser.quit()
现在问题在于实际的 Chrome Driver,我遇到了以下异常:
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 94
Current browser version is 93.0.4577.82 with binary path /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
我去了chromedriver下载网站,但我仍然遇到了相同的错误。