2017-08-09 60 views
0

我不能做硒以下兩個進口硒3.4.0進口org.openqa.selenium.remote.CapabilityType不能得到解決

import org.openqa.selenium.remote.CapabilityType; 
import org.openqa.selenium.remote.DesiredCapabilities; 

我的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> 

我收到提示messageslike The import org.openqa.selenium.remote.CapabilityType cannot be resolved在Eclipse

可能是什麼問題呢?

+0

嘗試'項目右側mouse' - >'maven' - >'更新project' - >'更新depedencies' – ByeBye

+0

@ByeBye我已經做到了很多次,仍然不起作用。 – chenzen

回答

0

當您嘗試包括以下進口:

import org.openqa.selenium.remote.CapabilityType; 
import org.openqa.selenium.remote.DesiredCapabilities; 

您已經添加了org.seleniumhq.seleniumorg.seleniumhq.selenium依賴於pom.xml。現在

,按照該Selenium 3.4.0 Documentationhere,只要你想使用RemoteWebDriver實現,你仍然需要從Selenium Download頁面並下載selenium-server-standalone.jar,然後要麼把它變成你的資源文件夾,並操縱它通過運行時間或放在別的地方並通過命令行操作。

+0

我嵌入了硒服務器。這個問題僅在硒3.4.0。它在硒3.0.1(與鉻)完美的工作。我想用最新的硒版本來使用geckodriver。 – chenzen

+0

@chenzen那麼你現在究竟卡在哪裏?你下載了'selenium-server-standalone.jar'嗎?你能分享你的研究嗎? – DebanjanB

+0

我通過直接將selenium java客戶端添加到構建路徑來解決此問題。 – chenzen

0

添加這種額外的依賴在你的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> 
+0

仍然不起作用。已經嘗試過這個。 – chenzen

相關問題