我在 Maven 存储库下看到以下依赖项
selenium-java
selenium-api
selenium-support
selenium-server
selenium-Firefox-driver
等。
Link : https://mvnrepository.com/artifact/org.seleniumhq.selenium
虽然我了解其他人,但我无法理解两者之间的区别:
- selenium-api
- Selenium 支持
我们什么时候应该使用它们?
最佳答案
如果您使用 Maven,您将直接在 Central Maven Repository 中找到所有 Selenium Maven Artifact
为了开始在您的 Maven 项目中使用任何实现,您只需在 pom.xml
中添加所需的依赖项(当前版本是 Selenium v3. 141.59
):
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
下图显示了不同Selenium Maven Artifact 之间的依赖关系以及这些 Artifact 中最重要的类/接口(interface):
如果您知道您只会使用某个WebDriver 实现,例如FirefoxDriver,您不需要依赖 selenium-java
Artifact (它有很多传递依赖项)。相反,您可以只添加对所需 Artifact 的 firefox-driver
依赖项。
Selenium API
selenium-api Artifact 包含以下内容:
- Selenium
- WebDriver
Selenium 支持
selenium-support Artifact 包含以下内容:
关于maven - Maven 存储库中的 Selenium Maven Artifact selenium-api 和 selenium-support 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54841651/