【问题标题】:Getting error in Robot Framework driver (The path to the driver executable must be set by the webdriver.chrome.driver)Robot Framework 驱动程序出错(驱动程序可执行文件的路径必须由 webdriver.chrome.driver 设置)
【发布时间】:2019-02-08 11:24:53
【问题描述】:

我创建了以下 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下载

【问题讨论】:

    标签: testing robotframework


    【解决方案1】:

    chromedriver.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();
    

    【讨论】:

    • OP 的环境是 *nix - 检查提供的路径,问题是在 Robotframework 的上下文中 - 而不是 vanilla java+webdriver selenium。
    猜你喜欢
    • 2020-11-27
    • 1970-01-01
    • 1970-01-01
    • 2013-08-18
    • 2018-03-17
    • 2016-11-04
    • 1970-01-01
    • 2015-05-14
    • 2017-04-26
    相关资源
    最近更新 更多