testing - 在机器人框架驱动程序中出现错误(驱动程序可执行文件的路径必须由 webdriver.chrome.driver 设置)
问题描述
我创建了以下 java 类:
public class setup {
public void browserSetup() {
// System.setProperty("webdriver.chrome.driver","/home/cangouser-38/Documents/mohan/chromedriver");
}
我的机器人框架测试用例如下所示:
*** Settings ***
Documentation A resource file containing the application specific keywords
Library Selenium2Library
Library com.Auto.Robot.SeleniumRobot.setup
*** Test Cases ***
Check out joe colantonio dot com
Open Browser https://www.google.com gc
Close Browser
驱动程序可执行文件的路径必须由 webdriver.chrome.driver 系统属性设置;有关更多信息,请参阅https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver。最新版本可从http://chromedriver.storage.googleapis.com/index.html下载
解决方案
铬驱动程序。exe :-)
我使用自己的 Chrome 配置文件进行的设置:
// path to chromedriver.exe
System.setProperty("webdriver.chrome.driver", "C:\\Users\\pburgr\\Desktop\\chromedriver\\chromedriver.exe");
// new instace of ChromeOptions
ChromeOptions options = new ChromeOptions();
// add arg to load Chrome with my own profile instead of a temporary profile
options.addArguments("user-data-dir=C:\\Users\\pburgr\\AppData\\Local\\Google\\Chrome\\User Data");
// new instance of ChromeDriver with added args
driver = new ChromeDriver(options);
// maximaze current window, can be used later again if window get minimaze or after a new window is opened (in Chrome no switch is needed)
driver.manage().window().maximize();
推荐阅读
- java - Gradle Junit 5 - 使用 jar 进行测试
- c - 由于警告 C6031(“忽略返回值:'scanf'),Visual Studios 不会编译代码
- python - if 表达式来查找文本是否在 DictReader 键的字段中
- django - 我想过滤 def 'getAmountRating(self):' 函数
- python - SLURM Python脚本在循环中累积内存
- pandas - 列表的数据框到 multiIndex 数据框
- c++ - 将 Google 基准与 cmake 关联
- python - Discord py 获取消息
- r - 如何按变量汇总保留名称
- c++ - 使用访问者时提升变体转换错误