本文介绍了硒2镀铬驱动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我已经阅读了所有关于在我的路径中添加chromedriver的文档,并遵循了所有文档.我在使用selenium2,maven,eclipse和所有最新驱动程序的Mac上:

So I have read all the docs on adding chromedriver to my path and followed all of them. I am on a Mac with selenium2, maven, eclipse, and all the latest drivers:

Error:
The path to the chromedriver executable must be set by the webdriver.chrome.driver system property;

我将chromedriver放在应用程序"文件夹中,路径如下:

I put chromedriver in my Applications folder and my path looks like:

echo $PATH  
/Users/tcerrato/selenium/BS_Sel_Project/auto_helper/test_scripts:/usr/local/apache-maven-2.2.1//bin:/Users/oracle/oracle/product/10.2.0/db_1/bin:/opt/local/bin:/opt/local/sbin:/Applications:

我想念什么?我根本无法使用chrome驱动程序运行.任何帮助都会很棒,我现在正在尝试随机的东西.

What am I missing? I cannot run with chrome driver at all. Any help would be great I'm trying random stuff now.

这是我关于硒的pom部分:

Here is my pom section on selenium:

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium</artifactId>
    <version>2.0rc2</version>
    <type>pom</type>
</dependency>
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-chrome-driver</artifactId>
    <version>2.5.0</version>
</dependency>
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-firefox-driver</artifactId>
    <version>2.6.0</version>
</dependency>

推荐答案

我不确定Maven,但这是我如何设置属性webdriver.chrome.driver

I am not sure about Maven but this how I set the property webdriver.chrome.driver

System.setProperty("webdriver.chrome.driver", "C:\\pathto\\my\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://www.google.com");

这篇关于硒2镀铬驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 05:02