Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法解析导入org.openqa.selenium.remote.CapabilityType_Java_Maven_Selenium - Fatal编程技术网

Java 无法解析导入org.openqa.selenium.remote.CapabilityType

Java 无法解析导入org.openqa.selenium.remote.CapabilityType,java,maven,selenium,Java,Maven,Selenium,我无法在Selenium 3.4.0中执行以下两个导入 import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; 我对selenium的maven依赖项如下: <dependency> <groupId>org.seleniumhq.selenium</groupId> <a

我无法在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> 

org.seleniumhq.selenium
硒爪哇
3.4.0  
org.seleniumhq.selenium
硒服务器
3.4.0  
我收到了错误消息,如在Eclipse中导入org.openqa.selenium.remote.CapabilityType无法解析


可能是什么问题?

当您尝试包括以下导入时:

import org.openqa.selenium.remote.CapabilityType;  
import org.openqa.selenium.remote.DesiredCapabilities;
您已经在
pom.xml
中添加了
org.seleniumhq.selenium
org.seleniumhq.selenium
依赖项


现在,根据Selenium 3.4.0文档,当您想使用RemoteWebDriver实现时,您仍然需要从页面下载selenium server standalone.jar,然后将其放入资源文件夹中,通过运行时进行操作,或者将其放在其他地方,通过命令行进行操作。

在pom.xml中添加此附加依赖项

<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-remote-driver -->
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-remote-driver</artifactId>
    <version>2.44.0</version>
</dependency>

org.seleniumhq.selenium
selenium远程驱动程序
2.44.0

在project上尝试
鼠标右键
maven->
更新项目
->
更新依赖项
@ByeBye我已经做了很多次了,仍然不起作用。我嵌入了selenium服务器。这个问题只针对selenium 3.4.0。它在硒3.0.1(含铬)中工作得非常好。我正在尝试将geckodriver与最新的selenium版本一起使用。@chenzen那么你现在到底被困在哪里了?您下载了selenium服务器standalone.jar吗?你能分享你的研究成果吗?我通过将selenium java客户端直接添加到构建路径来解决这个问题。