Robot Framework在PATH变量中找不到chromedriver

Rum*_*men 0 automation robotframework selenium-chromedriver

我想使用Chrome进行Robot Framework的自动化测试。这是我的设置:

*User variables:*
name: webdriver.chrome.driver
value: C:\chromedriver_win32\chromedriver.exe

name: PATH
values: ......;C:\chromedriver_win32\chromedriver.exe
Run Code Online (Sandbox Code Playgroud)

我的代码:

*** Settings ***

Library  BuiltIn
Library  Selenium2Library
Library  SikuliLibrary
Library  OperatingSystem

*** Variables ***
${HOST} =  VM
${URL} =  http://VM.com

${BROWSER} =  Chrome


*** Test Cases ***
Begin Web Test
    Open Browser  ${URL}   ${BROWSER}
    maximize browser window
Run Code Online (Sandbox Code Playgroud)

执行命令后:pybot test.robot:

==============================================================================
[ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: No brows
er is open
Test Case                                                             FException
 AttributeError: "'Service' object has no attribute 'process'" in <bound method
Service.__del__ of <selenium.webdriver.chrome.service.Service object at 0x000000
0003670278>> ignored
Test Case                                                             | FAIL |
Setup failed:
WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Plea
se see https://sites.google.com/a/chromium.org/chromedriver/home
------------------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)

怎么了

谢谢

Bry*_*ley 6

“ chromedriver可执行文件必须位于PATH中”意味着chromedriver 的位置必须位于路径中。在您的情况下,路径必须为“ ...; C:\ chromedriver_win32”。PATH包含文件夹,而不是可执行文件。