首页 > 解决方案 > 在机器人框架驱动程序中出现错误(驱动程序可执行文件的路径必须由 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下载

标签: testingrobotframework

解决方案


铬驱动程序。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();

推荐阅读