我已经使用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