zoukankan      html  css  js  c++  java
  • Jenkins调用selenium找不到webdriver:selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary

    jenkins集成web_UI自动化脚本,发送的html报告中显示:   

    selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary

    如下图:

    使用Chrome浏览器时,经常会遇到以下报错:浏览器没有调用起来

    通常由两种问题引起的:

    1.ChromeDriver.exe驱动有问题(包括版本,路径等等)

    2.Chrome.exe本身有问题。

    网上搜索的解决方案:三个

    1.指定chromedriver.exe驱动绝对路径

    driver = webdriver.Chrome(r'd:xxxchromedriver.exe')

    2.添加chrome.exe到系统path环境变量

    3.在代码中指定chrome.exe绝对路径。设置binary_location属性

    option = webdriver.ChromeOptions()

    option.binary_location=r'C:UsersAdministratorAppDataLocalGoogleChromeApplicationchrome.exe

    driver = webdriver.Chrome()

    driver.get('https://www.baidu.com')


    以上方案均未解决我的问题,最终解决方案如下:

       原因是:安装的chrome浏览器是在userApp下面,jenkins运行找不到

       解决方法如下两种:

      1.重新安装chrome放在C:Program Files (x86)下面

      C:Program Files (x86)GoogleChromeApplication

      2.【从user下面拷贝整个google文件夹到:C:Program Files (x86)】

  • 相关阅读:
    伟大的作曲家 —— 贝多芬与莫扎特、巴赫
    伟大的作曲家 —— 贝多芬与莫扎特、巴赫
    动漫知多少
    动漫知多少
    品牌的命名
    品牌的命名
    作为电磁波的 Wi-Fi 信号
    作为电磁波的 Wi-Fi 信号
    Opencv 使用Stitcher类图像拼接生成全景图像
    Hibernate的fetch
  • 原文地址:https://www.cnblogs.com/caixinxiong/p/12616720.html
Copyright © 2011-2022 走看看