Python Selenium Chrome驱动程序版本75e

2024-09-30 01:20:18 发布

您现在位置:Python中文网/ 问答频道 /正文

我有铬v75。下面的代码返回一个错误。在

selenium.webdriver.Chrome(service_log_path='NUL', executable_path=info['location'] + '/Variables/Common/Browsers/chromedriver.exe', options=ops, desired_capabilities={'binary_location': 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe'})

以及错误

^{pr2}$

如何安装两个版本的Chrome?(在1个Windows配置文件上)

我尝试了一个便携式Chrome版本,但chromedriver不会接受Chrome.exe. 在

请帮忙!谢谢


Tags: path代码版本logselenium错误servicelocation
1条回答
网友
1楼 · 发布于 2024-09-30 01:20:18

我不相信你能有一个单一的配置文件与2个版本的铬,如果我理解正确。但是,只要你能调整Chrome驱动程序和Chrome二进制文件的正确路径,你可以随时调整你的配置文件,以使用多个版本。在

下面是一个使用单数配置文件的示例,以及一个多配置文件的示例,通过该示例,我们可以在字典中循环键、值对,并在方法中使用这些调整。在

单一轮廓

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

def single_profile():

    """ Initiate Chrome Options """
    options = webdriver.ChromeOptions()

    """ Set Driver and Binary Path """
    options.binary_location = r'C:/chromium-version-XX/chrome.exe'
    driver_path='C:/path/to/chromedriver-version-XX.exe'

    """ Create Chrome instance with our parameters """
    driver = webdriver.Chrome(chrome_options=options, executable_path=driver_path)

if __name__ == '__main__':
    single_profile()

多配置文件

^{pr2}$

相关问题 更多 >

    热门问题