我不熟悉Robotframework,写了我的第一个硒测试,遇到了一个问题,即我无法使用机器人框架的“打开浏览器”命令来打开浏览器。它给我错误“ chromedrvier可执行文件需要在PATH中”。我在PATH中有chromedriver,可以使用终端运行chromdriver,而不必导航到bin文件夹。
给我错误的代码:
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
SeleniumTestCase
Open Browser https://www.google.com chrome
Wait Until Element Is Visible name=q
Input Text name=q weRplay
Wait Until Element Is Visible name=btnK
Click Button name=btnK
Sleep 3
Close All Browsers
适用于我的代码:
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
SeleniumTestCase
Create Webdriver Chrome executable_path=/usr/local/bin/chromedriver
Go To https://www.google.com
Wait Until Element Is Visible name=q
Input Text name=q weRplay
Wait Until Element Is Visible name=btnK
Click Button name=btnK
Sleep 3
Close All Browsers
我正在使用以下工具:
将ChromeDriver.exe放入C:\ .....的Python文件夹中,重新启动RED或Eclipse。如果您这样写,它应该可以工作
Open Browser http://www.random.com ie