NoSuchMethodError: org.openqa.selenium.os.CommandLine.findExecutable(Ljava/lang/String;)Ljava/lang/String;使用 SoapUI 启动 Chrome 时 [英] NoSuchMethodError: org.openqa.selenium.os.CommandLine.findExecutable(Ljava/lang/String;)Ljava/lang/String; while launching Chrome using SoapUI

查看:23
本文介绍了NoSuchMethodError: org.openqa.selenium.os.CommandLine.findExecutable(Ljava/lang/String;)Ljava/lang/String;使用 SoapUI 启动 Chrome 时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下启动脚本从 SoapUI 5.2.1 工具启动 selenium 脚本:

I'm trying to launch the selenium scripts from SoapUI 5.2.1 tool with the following launching script:

System.setProperty("webdriver.chrome.driver","D:\SoapUI-5.2.1\bin\ext\chromedriver.exe")
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.MyUrl.com")
driver.manage().timeouts().implicitlyWait(120,TimeUnit.SECONDS);

我在 SoapUI/bin/ext 文件夹中保存了以下 selenium 依赖文件

I have kept the following selenium dependency file in SoapUI/bin/ext folder

- chromedriver 2.36
- selenium-server-standalone-3.4.0.jar
- selenium-chrome-driver-2.3.1.jar

但是我在运行脚本时收到以下错误消息.

But I'm getting the following error message while running the script.

Tue May 22 15:51:47 IST 2018:ERROR:java.lang.NoSuchMethodError: org.openqa.selenium.os.CommandLine.findExecutable(Ljava/lang/String;)Ljava/lang/String;
   java.lang.NoSuchMethodError: org.openqa.selenium.os.CommandLine.findExecutable(Ljava/lang/String;)Ljava/lang/String;
    at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:84)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:87)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
    at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186)
    at Script1.launchURL(Script1.groovy:49)
    at Script1.run(Script1.groovy:20)
    at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:92)
    at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:141)
    at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:250)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

任何人都可以帮助我解决这个问题,因为我无法在 Google 中找到正确的解决方案.

Anyone help me to solve this issue as I'm not able to find correct solution in Google.

谢谢
Karunagara Pandi

Thanks
Karunagara Pandi

推荐答案

此错误信息...

java.lang.NoSuchMethodError: org.openqa.selenium.os.CommandLine.findExecutable(Ljava/lang/String;)Ljava/lang/String;
   java.lang.NoSuchMethodError: org.openqa.selenium.os.CommandLine.findExecutable(Ljava/lang/String;)Ljava/lang/String;

...暗示当 os 命令 findExecutable() 尝试根据您的 System.setProperty() 行定位可执行文件时引发了 NoSuchMethodError.

...implies that a NoSuchMethodError was raised when the os command findExecutable() tried to locate the executable as per your System.setProperty() line.

NoSuchMethodError 扩展IncompatibleClassChangeError 并且根据 Java 文档,如果应用程序尝试调用类的指定方法(静态或实例),并且该类不再具有该方法的定义.通常,此错误会被编译器捕获,并且此错误只会在运行时发生,如果类的定义发生了不兼容的更改.不兼容的类更改是由于当前执行的方法所依赖的某个类的定义发生了变化.

NoSuchMethodError extends IncompatibleClassChangeError and as per the Java Docs it is thrown if an application tries to call a specified method of a class (either static or instance), and that class no longer has a definition of that method. Normally, this error is caught by the compiler and this error can only occur at run time if the definition of a class has incompatibly changed. Incompatible class change occurs due to change in definition of some class, on which the currently executing method depends.

您已经创建了 WebDriver 实例,即 driver 并通过 ChromeDriver() 进行了转换.但是 SoapUI/bin/ext 子目录包含来自 selenium-server-standalone-3.4.0.jarselenium-chrome-driver-2.3 的多个定义.1.jar.

You have created the WebDriver instance i.e. driver and casted it through ChromeDriver(). But the SoapUI/bin/ext sub-directory contains multiple defination from selenium-server-standalone-3.4.0.jar and selenium-chrome-driver-2.3.1.jar.

执行以下步骤:

  • SoapUI/bin/ext 子目录中删除 selenium-chrome-driver-2.3.1.jar.
  • JDK 升级到最新级别 JDK 8u171.
  • Selenium 升级到当前级别版本 3.11.0.
  • ChromeDriver 升级到当前的 ChromeDriverv2.38 级别.
  • Chrome 版本保持在 Chrome v66.x 级别.(根据 ChromeDriver v2.38 发行说明)
  • 清理您的项目工作区,通过您的 IDE重建您的项目,仅使用所需的依赖项.
  • 使用 CCleaner 工具清除所有操作系统杂事在执行测试套件之后.
  • 如果您的基本Web Client 版本太旧,请通过卸载它Revo Uninstaller 并安装 Web Client 的最新 GA 和发布版本.
  • 进行系统重启.
  • 执行您的@Test.
  • Remove selenium-chrome-driver-2.3.1.jar from SoapUI/bin/ext sub-directory.
  • Upgrade JDK to recent levels JDK 8u171.
  • Upgrade Selenium to current levels Version 3.11.0.
  • Upgrade ChromeDriver to current ChromeDriver v2.38 level.
  • Keep Chrome version at Chrome v66.x levels. (as per ChromeDriver v2.38 release notes)
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
  • If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
  • Take a System Reboot.
  • Execute your @Test.

这篇关于NoSuchMethodError: org.openqa.selenium.os.CommandLine.findExecutable(Ljava/lang/String;)Ljava/lang/String;使用 SoapUI 启动 Chrome 时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆