【问题标题】:chromedriver does not find google chrome binary with robotframeworkchromedriver 找不到带有 robotsframework 的 google chrome 二进制文件
【发布时间】:2019-03-31 17:20:11
【问题描述】:

我想在 Google Chrome 中使用 robotsframework。不知何故,chromedriver 找不到 Google Chrome 二进制文件:

WebDriverException: Message: unknown error: cannot find Chrome binary

当我尝试使用 Firefox 运行测试时,它运行良好。我在网上搜索了一些解决方案,但我只找到了指定 chromedriver 路径的文章,而不是 Google Chrome 二进制文件。

这是我安装的。

pybot --version
Robot Framework 3.0.4 (Python 3.5.4 on darwin)

使用 pybot 执行的代码:google.robot

*** Settings ***
Documentation  Hello World for robotframwork with headless chrome
Library  SeleniumLibrary
#Library  OperatingSystem
#Suite Setup  Setup chromedriver
### https://stackoverflow.com/questions/28537290/how-to-set-path-chrome-driver-in-robot-framework

#*** Keywords ****
#Setup chromedriver
   #Set Environment Variable  webdriver.chrome.driver  /usr/local/bin/chromedriver
   #Set Environment Variable  webdriver.chrome.binary  /Applications/Chrome.app/Contents/MacOS/Google\ Chrome

*** Test Cases ***
User shall call google and make a screenshot
    [Documentation]  First test
    [Tags]  Headless
    #Open Browser  https://google.com  ff
    Open Browser  https://google.com  gc
    #Open Browser  https://google.com  headlesschrome
    Capture Page Screenshot
    Close All Browsers

当我运行这段代码时,我得到以下信息:

pybot google.robot
==============================================================================
Google :: Hello World for robotframwork with headless chrome
==============================================================================
User shall call google and make a screenshot :: First test            | FAIL |
WebDriverException: Message: unknown error: cannot find Chrome binary
  (Driver info: chromedriver=2.43.600229 (3fae4d0cda5334b4f533bede5a4787f7b832d052),platform=Mac OS X 10.11.6 x86_64)
------------------------------------------------------------------------------
Google :: Hello World for robotframwork with headless chrome          | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Output:  /Users/foo/workspace/robotframework/output.xml
Log:     /Users/foo/workspace/robotframework/log.html
Report:  /Users/foo/workspace/robotframework/report.html

【问题讨论】:

标签: python selenium robotframework


【解决方案1】:

根据@DebanjanB 评论,我找到了我的解决方案。

chromedriver 在

上搜索 OSX 上的 Chrome 浏览器
/Applications/Google Chrome.app/Contents/MacOS/Google Chrome

Chrome 安装在我的 OSX 上:

/Applications/Chrome.app/Contents/MacOS/Google Chrome

在我的文件系统上,我将Chrome.app 重命名为Google Chrome.app,从那时起它就起作用了。对于任何其他操作系统,请参阅Chromedriver Requirements

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-09-25
    • 1970-01-01
    • 1970-01-01
    • 2016-09-19
    • 2012-07-15
    • 2021-11-17
    • 2021-05-22
    相关资源
    最近更新 更多