Jmeter Chromedriver错误:未知错误:从远程主机执行时,DevToolsActivePort文件不存在
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Jmeter Chromedriver错误:未知错误:从远程主机执行时,DevToolsActivePort文件不存在相关的知识,希望对你有一定的参考价值。
我正在尝试使用WebDriver插件和安装的chrome-driver从JMeter执行WebDriver采样器脚本。 JMeter配置为在分布式模式下工作。我目前有2个节点,一个Master和一个Slave。我的脚本驻留在主机上,我正在尝试使用以下命令从主机执行它。
$JMETER_HOME/bin/jmeter -n -t recorder1.jmx -r
我收到此错误:
2019-03-10 16:18:03,416 INFO o.a.j.s.BatchSampleSender: Using batching for this run. Thresholds: num=100, time=60000
2019-03-10 16:18:03,417 INFO o.a.j.s.DataStrippingSampleSender: Using DataStrippingSampleSender for this run with stripAlsoOnError: true
2019-03-10 16:18:03,417 INFO o.a.j.s.BatchSampleSender: Using batching for this run. Thresholds: num=100, time=60000
2019-03-10 16:18:03,418 INFO o.a.j.s.DataStrippingSampleSender: Using DataStrippingSampleSender for this run with stripAlsoOnError: true
2019-03-10 16:18:03,429 INFO o.a.j.e.RemoteJMeterEngineImpl: Creating JMeter engine on host xx.xxx.xxx.xx base '..'
2019-03-10 16:18:03,430 INFO o.a.j.e.RemoteJMeterEngineImpl: Remote client host: 10.xxx.xxx.xxx
2019-03-10 16:18:03,430 INFO o.a.j.s.FileServer: Set new base='..'
2019-03-10 16:18:03,431 INFO o.a.j.e.RemoteJMeterEngineImpl: Cleaning previously set properties: {}
2019-03-10 16:18:03,431 INFO o.a.j.e.StandardJMeterEngine: Applying properties {}
2019-03-10 16:18:03,431 INFO o.a.j.e.RemoteJMeterEngineImpl: Running test
2019-03-10 16:18:03,437 INFO o.a.j.e.StandardJMeterEngine: Running the test!
2019-03-10 16:18:03,438 INFO o.a.j.s.SampleEvent: List of sample_variables: []
2019-03-10 16:18:03,504 INFO o.a.j.e.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group
2019-03-10 16:18:03,504 INFO o.a.j.e.StandardJMeterEngine: Starting 1 threads for group Thread Group.
2019-03-10 16:18:03,504 INFO o.a.j.e.StandardJMeterEngine: Thread will continue on error
2019-03-10 16:18:03,504 INFO o.a.j.t.ThreadGroup: Starting thread group... number=1 threads=1 ramp-up=1 perThread=1000.0 delayedStart=false
2019-03-10 16:18:03,507 INFO o.a.j.t.ThreadGroup: Started thread group number 1
2019-03-10 16:18:03,507 INFO o.a.j.e.StandardJMeterEngine: All thread groups have been started
2019-03-10 16:18:03,508 INFO o.a.j.t.JMeterThread: Thread started: xx.xxx.xxx.xx-Thread Group 1-1
2019-03-10 16:18:03,649 ERROR o.a.j.t.JMeterThread: Error calling threadStarted
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
(Driver info: chromedriver=2.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926),platform=Linux 4.15.0-1033-aws x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 111 milliseconds
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'jmeter-slave', ip: '10.xxx.xxx.xxx', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-1033-aws', java.version: '10.0.2'
Driver info: driver.version: ChromeDriver
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
at java.lang.reflect.Constructor.newInstance(Constructor.java:488) ~[?:?]
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214) ~[selenium-remote-driver-3.14.0.jar:?]
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166) ~[selenium-remote-driver-3.14.0.jar:?]
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53) ~[selenium-remote-driver-3.14.0.jar:?]
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91) ~[selenium-remote-driver-3.14.0.jar:?]
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:122) ~[selenium-remote-driver-3.14.0.jar:?]
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[?:?]
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958) ~[?:?]
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127) ~[?:?]
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502) ~[?:?]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488) ~[?:?]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150) ~[?:?]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543) ~[?:?]
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:125) ~[selenium-remote-driver-3.14.0.jar:?]
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73) ~[selenium-remote-driver-3.14.0.jar:?]
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136) ~[selenium-remote-driver-3.14.0.jar:?]
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83) ~[selenium-remote-driver-3.14.0.jar:?]
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548) ~[selenium-remote-driver-3.14.0.jar:?]
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212) ~[selenium-remote-driver-3.14.0.jar:?]
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130) ~[selenium-remote-driver-3.14.0.jar:?]
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181) ~[selenium-chrome-driver-3.14.0.jar:?]
at com.googlecode.jmeter.plugins.webdriver.config.ChromeDriverConfig.createBrowser(ChromeDriverConfig.java:74) ~[jmeter-plugins-webdriver-3.0.jar:?]
at com.googlecode.jmeter.plugins.webdriver.config.ChromeDriverConfig.createBrowser(ChromeDriverConfig.java:21) ~[jmeter-plugins-webdriver-3.0.jar:?]
at com.googlecode.jmeter.plugins.webdriver.config.WebDriverConfig.getPreparedBrowser(WebDriverConfig.java:233) ~[jmeter-plugins-webdriver-3.0.jar:?]
at com.googlecode.jmeter.plugins.webdriver.config.WebDriverConfig.threadStarted(WebDriverConfig.java:220) ~[jmeter-plugins-webdriver-3.0.jar:?]
at org.apache.jmeter.threads.JMeterThread$ThreadListenerTraverser.addNode(JMeterThread.java:762) [ApacheJMeter_core.jar:5.1 r1853635]
at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:994) [jorphan.jar:5.1 r1853635]
at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:995) [jorphan.jar:5.1 r1853635]
at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:977) [jorphan.jar:5.1 r1853635]
at org.apache.jmeter.threads.JMeterThread.threadStarted(JMeterThread.java:730) [ApacheJMeter_core.jar:5.1 r1853635]
at org.apache.jmeter.threads.JMeterThread.initRun(JMeterThread.java:718) [ApacheJMeter_core.jar:5.1 r1853635]
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:249) [ApacheJMeter_core.jar:5.1 r1853635]
at java.lang.Thread.run(Thread.java:844) [?:?]
2019-03-10 16:18:03,952 ERROR o.a.j.t.JMeterThread: Error while processing sampler: 'jp@gc - LoadWidgetAllInOne'.
java.lang.IllegalArgumentException: Browser has not been configured. Please ensure at least 1 WebDriverConfig is created for a ThreadGroup.
at com.googlecode.jmeter.plugins.webdriver.sampler.WebDriverSampler.sample(WebDriverSampler.java:62) ~[jmeter-plugins-webdriver-3.0.jar:?]
at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:622) ~[ApacheJMeter_core.jar:5.1 r1853635]
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:546) ~[ApacheJMeter_core.jar:5.1 r1853635]
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:486) [ApacheJMeter_core.jar:5.1 r1853635]
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:253) [ApacheJMeter_core.jar:5.1 r1853635]
at java.lang.Thread.run(Thread.java:844) [?:?]
2019-03-10 16:18:03,957 INFO o.a.j.t.JMeterThread: Thread is done: xx.xxx.xxx.xx-Thread Group 1-1
2019-03-10 16:18:03,957 INFO o.a.j.t.JMeterThread: Thread finished: xx.xxx.xxx.xx-Thread Group 1-1
2019-03-10 16:18:03,969 INFO o.a.j.e.StandardJMeterEngine: Notifying test listeners of end of test
2019-03-10 16:18:03,969 INFO o.a.j.s.DataStrippingSampleSender: Test Ended on xx.xxx.xxx.xx
2019-03-10 16:18:03,969 INFO o.a.j.s.BatchSampleSender: Test Ended on xx.xxx.xxx.xx
2019-03-10 16:18:03,970 INFO o.a.j.s.DataStrippingSampleSender: Test Ended on xx.xxx.xxx.xx
2019-03-10 16:18:03,970 INFO o.a.j.s.BatchSampleSender: Test Ended on xx.xxx.xxx.xx
2019-03-10 16:18:03,971 INFO o.a.j.e.StandardJMeterEngine: Test has ended on host xx.xxx.xxx.xx
JMeter-Server在Slave实例上的ubuntu用户下运行。我也使用ubuntu用户从Master机器执行测试。我看到如果chromedriver是用超级用户执行的,它可能会导致像我一样的问题,但事实并非如此。
最奇怪的是,如果我在无头模式下执行相同的脚本,它可以正常工作。此外,如果我从GUI或从机上的命令行执行相同的脚本,它也可以正常工作而不会出错。
安装:
- 使用Ubuntu 18.04的EC2实例
- Apache的JMeter的-5.1
- ChromeDriver 2.45.615355
- JMeter的-插件-的webdriver-3.0.jar
有任何想法吗?
建议在那里添加以下代码:
System.setProperty("webdriver.chrome.driver","pathto\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("useAutomationExtension", false);
WebDriver driver = new ChromeDriver(options);
driver.get(url);
但是如何在JMeter的Chrome Driver Config步骤中初始化之前更改chromedriver选项?
- 根据我在ChromeDriver downloads page看到的:
Supports Chrome v70-72
因此请确保Ubuntu中安装的Chrome版本处于支持的范围内 - 鉴于操作系统是Ubuntu服务器,它不应该有GUI,而Chrome需要运行DISPLAY,无论是真实的还是virtual。在这两种情况下,您都应该定义DISPLAY变量并指向真实或虚拟显示。
- 首先,在运行JMeter slave时完全登录到机器,并将
/usr/bin/google-chrome
作为ubuntu
用户启动。如果它没有问题就开始了 - 你应该好好去,如果没有 - 你需要在尝试从JMeter使用它之前修复浏览器启动。您可以通过验证exit status - 运行下一个命令来仔细检查浏览器执行的结果:echo $?
如果你看到0
- 你很好,如果没有 - 你有问题。
以上是关于Jmeter Chromedriver错误:未知错误:从远程主机执行时,DevToolsActivePort文件不存在的主要内容,如果未能解决你的问题,请参考以下文章
用C语言编一个函数实现strcmp的功能,下面是我在vc++编的,但是有错误,我不知错哪了,请高手指教,谢谢
Python selenium Message: session not created: This version of ChromeDriver only supports Chrome vers