【问题标题】:Selenium chrome driver can't be found when added to eclipse as maven dependency将 Selenium chrome 驱动程序作为 maven 依赖项添加到 eclipse 时找不到
【发布时间】:2013-01-01 07:43:40
【问题描述】:

我在 4.2 Juno 中使用 m2e eclipse 插件。添加后,我在我的 maven 依赖项中看到 selenium-chrome-driver-2.26.0.jar 文件

<dependency>
   <groupId>org.seleniumhq.selenium</groupId>
   <artifactId>selenium-java</artifactId>
   <version>2.26.0</version>
</dependency>

到我的 pom.xml 文件。我收到典型的缺少驱动程序错误

java.lang.IllegalStateException: The path to the driver executable 
must be set by the webdriver.chrome.driver system property; ...

Firefox 驱动程序有效(它是自动的)。右键单击项目时,我可以使用 Maven 子菜单成功更新我的项目。 maven 依赖文件夹已添加到我的项目的构建路径中。我看过与这些类似的帖子,但运气不佳。

How to add maven repository jars to eclipse buildpath? How to configure Eclipse build path to use Maven dependencies?

【问题讨论】:

    标签: eclipse maven selenium m2e selenium-chromedriver


    【解决方案1】:

    这不是 ChromeDriver 类。

    您需要从here下载最新版本的chrome驱动

    解压压缩包,你会发现一个 .exe 文件。

    使用以下代码
    System.setProperty("webdriver.chrome.driver","&lt;path to Chromedriver .exe&gt;");

    否则设置 PATH 环境变量指向 ChromeDriver.exe 的位置

    【讨论】:

    • 我明白了,Maven 并没有那么神奇。我显然是一个 java n00b。谢谢。
    猜你喜欢
    • 2014-04-15
    • 1970-01-01
    • 2018-11-07
    • 1970-01-01
    • 2015-11-13
    • 2016-12-16
    • 2021-08-14
    • 2012-11-28
    • 2015-08-11
    相关资源
    最近更新 更多