我无法在 Selenium 3.4.0 中执行以下两个导入
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
我对 selenium 的 maven 依赖如下:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.4.0</version>
</dependency>
我收到错误消息,例如 The import org.openqa.selenium.remote.CapabilityType cannot be resolved
in Eclipse
可能是什么问题?
最佳答案
当您尝试包含以下导入时:
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
您已经在 pom.xml
中添加了 org.seleniumhq.selenium
和 org.seleniumhq.selenium
依赖项。
现在,根据 Selenium 3.4.0 文档
here 因为你想使用 RemoteWebDriver
实现,你仍然需要下载 selenium-server-standalone.jar
来自 Selenium Download
页面,然后将其放入您的资源文件夹并通过 Runtime 对其进行操作,或者将其放在其他位置并通过命令行对其进行操作。
关于java - 无法解析导入 org.openqa.selenium.remote.CapabilityType,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45597914/