Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
587 views
in Technique[技术] by (71.8m points)

NoSuchMethodError: org.openqa.selenium.os.CommandLine.findExecutable(Ljava/lang/String;)Ljava/lang/String; while launching Chrome using SoapUI

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);

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)

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

Thanks
Karunagara Pandi

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This error message...

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;

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

Class NoSuchMethodError

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.

What went wrong?

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.

Solution

Perform the following steps :

  • 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.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...