我已經使用Selenium和Maven創建了一個新的Java項目。這是在pom.xml中的相關內容Selenium程序拋出編譯錯誤org.openqa.selenium.internal.Killable無法解析
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.45.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>3.8.1</version>
</dependency>
</dependencies>
然後我創建了一個使用硒框架這個基本的Java程序:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Start {
public static void main(String[] args) {
// declaration and instantiation of objects/variables
System.setProperty("webdriver.firefox.marionette", "D:\\geckodriver.exe");
WebDriver driver = null;
try {
driver = new FirefoxDriver();
String baseUrl = "https://www.google.co.in/";
driver.get(baseUrl);
} finally {
driver.close();
}
}
}
不過,我得到這個編譯錯誤:
The type org.openqa.selenium.internal.Killable cannot be resolved. It is indirectly referenced from required .class files
有人可以建議我哪裏錯了嗎?
謝謝,這工作!即使在刪除條目後,問題也很少。我通過在本地maven回購中重新創建相關包來解決此問題 – CuriousCoder