Я пытаюсь выполнить сценарий сэмплера WebDriver из JMeter с установленным плагином WebDriver и хром-драйвером.JMeter настроен для работы в распределенном режиме.В настоящее время у меня есть 2 узла, один Мастер и один Раб.Мой сценарий находится на главной машине, и я пытаюсь выполнить его с главной машины, используя следующую команду.
$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 работает под пользователем Ubuntu на экземпляре Slave.Я выполняю свой тест с Master-машины также с пользователем Ubuntu.Я видел, что если chromedriver выполняется с суперпользователем, это может вызвать ту же проблему, что и у меня, но это не так.
Самое странное, что, если я выполняю тот же сценарий в автономном режиме, он работает нормально.Также, если я выполняю тот же сценарий из графического интерфейса или из командной строки на ведомой машине, он также работает без ошибок.
Установлено:
- Экземпляр EC2 с Ubuntu 18.04
- apache-jmeter-5.1
- ChromeDriver 2.45.615355
- jmeter-plugins-webdriver-3.0.jar
Любые идеи?
Я также видел возможное решение в: org.openqa.selenium.WebDriverException: неизвестная ошибка: файл DevToolsActivePort не работаетпри попытке запустить браузер Chrome
рекомендуется добавить следующий код:
System.setProperty("webdriver.chrome.driver","pathto\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("useAutomationExtension", false);
WebDriver driver = new ChromeDriver(options);
driver.get(url);
но как мне изменить параметры chromedriver до того, как он будет инициализирован на шаге настройки драйвера Chrome в JMeter?