我已将依赖项添加到我的 pom.xml 文件中:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.10.0</version>
</dependency>
我正在尝试最简单的测试:
@Test
public void logInChromeTest() {
System.setProperty("webdriver.chrome.driver", "E:\\Selenium\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://www.google.com");
这给了我这个:
java.lang.IllegalAccessError: tried to access method com.google.common.util.concurrent.SimpleTimeLimiter.<init>(Ljava/util/concurrent/ExecutorService;)V from class org.openqa.selenium.net.UrlChecker
我错过了什么?
编辑:
我检查了java.lang.IllegalAccessError 给出的解决方案:试图访问方法 com.google.common.util.concurrent.SimpleTimeLimiter。使用 Selenium-Java 3.5.1 或更高版本时,它并没有解决我的问题。目前正在使用 3.8.1 版,但仍然是同样的问题。