gpt4 book ai didi

java - 无法启动 Internet Explorer ---Selenium

转载 作者:行者123 更新时间:2023-12-01 19:36:15 25 4
gpt4 key购买 nike

我只是检查通过 selenium Webdriver 启动 IE11。很奇怪我得到这个运行时异常。请帮忙。Internetexplorer 驱动程序位于提到的路径中,selenium-server 独立版位于构建路径中。我有这样的代码:

 import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.Platform;

import org.openqa.selenium.WebElement;

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

public class Test {
static String url="https://meapps-stg70.aa.com/tessmapsui/" ;
public static void main(String[] args) {

System.setProperty("webdriver.ie.driver", "C:\\Users\\Public\\IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver();
driver.get("https://xx.com/xxui/");
driver.findElement(By.id("userID")).sendKeys("xxxxx");
driver.findElement(By.id("password")).sendKeys("xxxxx");
driver.findElement(By.id("login")).click();
driver.findElement(By.id("qs_aircft")).sendKeys("XYZ");;
driver.findElement(By.name("twdReport_Submit")).click();


}
}

It gives the runtime exception as follows:
Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;I)V
at org.openqa.selenium.remote.service.DriverService$Builder.usingPort(DriverService.java:285)
at org.openqa.selenium.ie.InternetExplorerDriver.setupService(InternetExplorerDriver.java:242)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:211)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:150)
at Test.main(Test.java:44)

最佳答案

现在工作正常。更新到最新的 Gauva 库并删除了旧的库。清理并重建并运行。

关于java - 无法启动 Internet Explorer ---Selenium,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59216525/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com