zoukankan      html  css  js  c++  java
  • selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary

    问题:
    ft19.1: Traceback (most recent call last): File "D:jenkinsworkspacePT4_0_UI_Script est_caseSystem_Management est_OData_permissions_update.py", line 14, in setUp driver = get_driver() File "../..common_modulesPT4_Login.py", line 12, in get_driver driver = webdriver.Chrome() File "D:Pythonlibsite-packagesseleniumwebdriverchromewebdriver.py", line 69, in __init__ desired_capabilities=desired_capabilities) File "D:Pythonlibsite-packagesseleniumwebdriver emotewebdriver.py", line 90, in __init__ self.start_session(desired_capabilities, browser_profile) File "D:Pythonlibsite-packagesseleniumwebdriver emotewebdriver.py", line 177, in start_session response = self.execute(Command.NEW_SESSION, capabilities) File "D:Pythonlibsite-packagesseleniumwebdriver emotewebdriver.py", line 236, in execute self.error_handler.check_response(response) File "D:Pythonlibsite-packagesseleniumwebdriver emoteerrorhandler.py", line 192, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary (Driver info: chromedriver=75.0.3770.90 (a6dcaf7e3ec6f70a194cc25e8149475c6590e025-refs/branch-heads/3770@{#1003}),platform=Windows NT 10.0.14393 x86_64)

    解决方案:
    1、浏览器版本和webdriver版本对应
    2、浏览器取消自动升级功能(删掉update文件夹下面的所有文件,设置update文件夹不允许任何操作)
    3、把下载的 chromedriver.exe 复制到以下路径
    1)python 根目录
    2)D:PythonLibsite-packagesseleniumwebdriver
    3)C:UsersAdministratorAppDataLocalGoogleChromeApplication
    4)环境变量path中添加:C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe
    4、完成以上所有设置,新建python文件测试
    代码如下:

    from selenium import webdriver
    import time
    option = webdriver.ChromeOptions()
    option.binary_location=r'D:GoogleChromeApplicationchrome.exe'
    driver=webdriver.Chrome('C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe')
    driver.get("https:www.baidu.com")
    time.sleep(10)
    driver.quit()

  • 相关阅读:
    关于easyUI tree的节点属性和自定义属性
    $.messager.prompt
    SQL SERVER 查询被锁的表、解锁表
    C# 连接Oracle 11g 无需安装Oracle客户端
    Oracle 常用语句备份
    Oracle中sys和system用户的区别
    Oracle 数据库创建、表空间创建、用户创建 步骤
    Oracle 创建数据库卡死在85%
    yield return 的使用方法
    Oracle SQL Developer 查询时间格式
  • 原文地址:https://www.cnblogs.com/shimo/p/13960069.html
Copyright © 2011-2022 走看看