首页 > 解决方案 > 在 Maven 项目中使用 Selenium

问题描述

我在 Eclipse 中使用以下依赖项创建了一个 MavenTestProject:

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
    </dependency>
</dependencies>

现在我的 Maven 依赖项文件夹包含这些浏览器的驱动程序:

Maven 依赖项

这些库是干什么用的?我可以只使用它们吗?还是我还需要下载其他 .exe 文件才能使用其他帖子中提到的驱动程序?

标签: mavenseleniumselenium-webdriverdependencies

解决方案


在 Chrome 上执行测试用例时需要下载 ChromeDriver.exe,ChromeDriver.exe 接受来自 Selenium 的命令,然后与 Chrome 浏览器通信。所以你需要下载exe文件。


推荐阅读