Python Selenium Beta Chrome驱动程序使用错误的二进制路径



我目前正在从chrome 102切换到104 Beta(因为103有一个未修复的错误,我用python - selenium脚本)

我安装了Chrome测试版104 + 104 Chrome驱动程序。当我启动脚本时,它识别出这是一个104驱动程序,但驱动程序本身在旧的chrome路径中搜索chrome.exe应用程序:

它现在搜索的位置:C:Program FilesGoogleChrome应用 chrome.exe

它应该搜索:C:Program FilesGoogleChrome BetaApplicationchrome.exe

是否有一些简单的方法来改变测试版chrome驱动程序搜索exe的二进制路径?一些简单的东西,我可以把我的python脚本将是可爱的。

在这种情况下,您应该指定selenium必须在Options类中使用binary_location查找chrome执行器。

试试这个:

假设您的chromedriver.exe和python文件在同一文件夹中,否则您将不得不指定chromedriver.exe的路径。

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
options = Options()
options.binary_location = r'C:Program FilesGoogleChrome BetaApplicationchrome.exe'
browser = webdriver.Chrome(options = options, service = Service("chromedriver.exe"))
browser.get(your_url)