【问题标题】:Unable to launch internet explorer ---Selenium [duplicate]无法启动 Internet Explorer ---Selenium [重复]
【发布时间】:2023-04-10 05:46:01
【问题描述】:

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

 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)

【问题讨论】:

    标签: java selenium selenium-webdriver


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2015-12-22
      • 1970-01-01
      • 1970-01-01
      • 2019-09-21
      • 2011-09-21
      • 2013-12-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多