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
问题描述
我试图用以下启动脚本从SoapUI 5.2.1工具启动selenium脚本:
系统。 setProperty(webdriver.chrome.driver,D:\\SoapUI-5.2.1\\\\\\\\\\\\\\\\\\\\\\\\\\\' ();
driver.manage()。window()。maximize();
driver.get(https://www.MyUrl.com)
driver.manage()。timeouts()。implicitlyWait(120,TimeUnit.SECONDS);
我在 SoapUI / bin / ext 中保留了以下硒依赖项文件文件夹
- chromedriver 2.36
- selenium-server-standalone-3.4.0.jar
- selenium -chrome-driver-2.3.1.jar
但运行脚本时遇到以下错误信息。
5月22日15:51:47 IST 2018年:错误:java.lang.NoSuchMethodError:org.openqa.selenium.os.CommandLine.findExecutable (Ljava /郎/字符串;)Ljava /郎/字符串;
java.lang.NoSuchMethodError:org.openqa.selenium.os.CommandLine.findExecutable(Ljava / lang / String;)Ljava / lang / String;在org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:84)
。在org.openqa.selenium.chrome.ChromeDriver<初始化>(ChromeDriver.java:87)
。在sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)
在sun.reflect.NativeConstructorAccessorImpl.newInstance(来源不明)
在sun.reflect.DelegatingConstructorAccessorImpl.newInstance(来源不明)
。在java.lang.reflect.Constructor.newInstance(来源不明)
在org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
在org.codehaus.groovy.runtime .callsite.ConstructorSite $ ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
在org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
在org.codehaus.groovy .runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
在org.codehaus.groovy。 runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186)
。在Script1.launchURL(Script1.groovy:49)
。在Script1.run(Script1.groovy:20)
。在玉米.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:92)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:141)$ b在com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel $ RunAction $ 1.run $ b(GroovyScriptStepDesktopPanel.java:250)
在java.util.concurrent.ThreadPoolExecutor.runWorker(来源不明)
at java.util.concurrent.ThreadPoolExecutor $ Worker.run(Unknown Source)$ b $ at java.lang.Thread.run(Unknown Source)
任何人都可以帮助我解决这个问题,因为我无法在Google中找到正确的解决方案。
感谢
Karunagara Pandi
这个错误信息...
java.lang.NoSuchMethodError:org.openqa.selenium.os.CommandLine.findExecutable(Ljava /朗/字符串;)Ljava /郎/字符串;
java.lang.NoSuchMethodError:org.openqa.selenium.os.CommandLine.findExecutable(Ljava / lang / String;)Ljava / lang / String;
...意味着一个 findExecutable()
尝试按照您的 System.setProperty()行
找到可执行文件。
Class NoSuchMethodError
NoSuchMethodError
扩展了 IncompatibleClassChangeError
和根据 Java Docs ,如果应用程序尝试调用某个类的指定方法(静态或实例),并且该类不再具有该方法的定义。通常,编译器会捕获此错误,并且如果类的定义发生了不兼容的更改,则此错误只能发生在运行时。 不兼容的类改变是由于当前正在执行的方法所依赖的某个类的定义发生更改。
出了什么问题?
您已经创建了 WebDriver 实例,即驱动程序并通过 ChromeDriver()进行转换。但是, SoapUI / bin / ext 子目录包含来自 selenium-server-standalone-3.4.0.jar 和 selenium-chrome-driver-2.3的多个定义.jar 。
解决方案
执行以下步骤:
- 从 SoapUI / bin / ext 子文件中删除 selenium-chrome-driver-2.3.1.jar -directory。
- 将 JDK 升级到最新级别 JDK 8u171 。 级别 3.11.0版 。
- 将 ChromeDriver 升级到目前的 ChromeDriver v2.38 级别。
- 将 Chrome 版保持在 Chrome v66.x 级别。 (根据ChromeDriver v2.38发行说明)
- 通过 IDE 清理 Project Workspace / li>
- 使用 CCleaner 工具擦除执行 test Suite 之前和之后关闭所有操作系统。
- 如果您的基础版 Web Client 版本太旧,然后通过
- 执行系统重新启动。
c $ c> @Test 。
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
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
.
这篇关于NoSuchMethodError:org.openqa.selenium.os.CommandLine.findExecutable(Ljava / lang / String;)Ljava / lang / String;同时使用SoapUI启动Chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!