jmeter WebDriverSampler测试失败,出现错误

avkwfej4  于 2023-04-12  发布在  其他
关注(0)|答案(1)|浏览(205)

我有一个简单的测试计划,使用WebDriver Sampler测试,配置Chrome驱动程序配置元素以使用/bin文件夹中的兼容Chromedriver<JMETER_HOME>。这是一个简单的测试,如两分钟指南所述。https://jmeter-plugins.org/wiki/WebDriverTutorial/
它过去一直工作得很好,直到最近,在升级Chrome浏览器+驱动程序后停止工作。
JMeter版本5.5 OS 12.6.4 Google Chrome:版本111.0.5563.146(Official Build)(arm 64)插件管理器和插件已更新到最新版本
执行测试时,我收到以下错误。

org.openqa.selenium.remote.http.ConnectionFailedException: Unable to establish websocket connection to http://localhost:51531/devtools/browser/2fa15e06-54bb-4e59-a09f-1cb2b742d2d5
Build info: version: '4.7.2', revision: '4d4020c3b7'
System info: os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '12.6.4', java.version: '18.0.2.1'
Driver info: driver.version: ChromeDriver
    at org.openqa.selenium.remote.http.netty.NettyWebSocket.<init>(NettyWebSocket.java:102) ~[selenium-remote-driver-4.7.2.jar:?]
    at org.openqa.selenium.remote.http.netty.NettyWebSocket.lambda$create$3(NettyWebSocket.java:128) ~[selenium-remote-driver-4.7.2.jar:?]
    at org.openqa.selenium.remote.http.netty.NettyClient.openSocket(NettyClient.java:107) ~[selenium-remote-driver-4.7.2.jar:?]
    at org.openqa.selenium.devtools.Connection.<init>(Connection.java:78) ~[selenium-remote-driver-4.7.2.jar:?]
    at org.openqa.selenium.chromium.ChromiumDriver.lambda$new$2(ChromiumDriver.java:116) ~[selenium-chromium-driver-4.7.2.jar:?]
    at java.util.Optional.map(Optional.java:260) ~[?:?]
    at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:114) ~[selenium-chromium-driver-4.7.2.jar:?]
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:82) ~[selenium-chrome-driver-4.7.2.jar:?]
    at com.googlecode.jmeter.plugins.webdriver.config.ChromeDriverConfig.createBrowser(ChromeDriverConfig.java:28) ~[jmeter-plugins-webdriver-4.8.3.1.jar:?]
    at com.googlecode.jmeter.plugins.webdriver.config.ChromeDriverConfig.createBrowser(ChromeDriverConfig.java:14) ~[jmeter-plugins-webdriver-4.8.3.1.jar:?]
    at com.googlecode.jmeter.plugins.webdriver.config.WebDriverConfig.getPreparedBrowser(WebDriverConfig.java:221) ~[jmeter-plugins-webdriver-4.8.3.1.jar:?]
    at com.googlecode.jmeter.plugins.webdriver.config.WebDriverConfig.threadStarted(WebDriverConfig.java:152) ~[jmeter-plugins-webdriver-4.8.3.1.jar:?]
    at org.apache.jmeter.threads.JMeterThread$ThreadListenerTraverser.addNode(JMeterThread.java:797) ~[ApacheJMeter_core.jar:5.5]
    at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:993) ~[jorphan.jar:5.5]
    at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:976) ~[jorphan.jar:5.5]
    at org.apache.jmeter.threads.JMeterThread.threadStarted(JMeterThread.java:765) ~[ApacheJMeter_core.jar:5.5]
    at org.apache.jmeter.threads.JMeterThread.initRun(JMeterThread.java:753) ~[ApacheJMeter_core.jar:5.5]
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:264) ~[ApacheJMeter_core.jar:5.5]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]
2023-04-07 11:37:16,235 ERROR o.a.j.t.JMeterThread: Test failed!
org.openqa.selenium.remote.http.ConnectionFailedException: Unable to establish websocket connection to http://localhost:51545/devtools/browser/e316304b-bf6b-46bf-96d7-28933b054a87
Build info: version: '4.7.2', revision: '4d4020c3b7'
System info: os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '12.6.4', java.version: '18.0.2.1'
Driver info: driver.version: ChromeDriver
    at org.openqa.selenium.remote.http.netty.NettyWebSocket.<init>(NettyWebSocket.java:102) ~[selenium-remote-driver-4.7.2.jar:?]
    at org.openqa.selenium.remote.http.netty.NettyWebSocket.lambda$create$3(NettyWebSocket.java:128) ~[selenium-remote-driver-4.7.2.jar:?]
    at org.openqa.selenium.remote.http.netty.NettyClient.openSocket(NettyClient.java:107) ~[selenium-remote-driver-4.7.2.jar:?]
    at org.openqa.selenium.devtools.Connection.<init>(Connection.java:78) ~[selenium-remote-driver-4.7.2.jar:?]
    at org.openqa.selenium.chromium.ChromiumDriver.lambda$new$2(ChromiumDriver.java:116) ~[selenium-chromium-driver-4.7.2.jar:?]
    at java.util.Optional.map(Optional.java:260) ~[?:?]
    at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:114) ~[selenium-chromium-driver-4.7.2.jar:?]
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:82) ~[selenium-chrome-driver-4.7.2.jar:?]
    at com.googlecode.jmeter.plugins.webdriver.config.ChromeDriverConfig.createBrowser(ChromeDriverConfig.java:28) ~[jmeter-plugins-webdriver-4.8.3.1.jar:?]
    at com.googlecode.jmeter.plugins.webdriver.config.ChromeDriverConfig.createBrowser(ChromeDriverConfig.java:14) ~[jmeter-plugins-webdriver-4.8.3.1.jar:?]
    at com.googlecode.jmeter.plugins.webdriver.config.WebDriverConfig.getPreparedBrowser(WebDriverConfig.java:221) ~[jmeter-plugins-webdriver-4.8.3.1.jar:?]
    at com.googlecode.jmeter.plugins.webdriver.config.WebDriverConfig.iterationStart(WebDriverConfig.java:198) ~[jmeter-plugins-webdriver-4.8.3.1.jar:?]
    at org.apache.jmeter.control.GenericController.fireIterationStart(GenericController.java:399) ~[ApacheJMeter_core.jar:5.5]
    at org.apache.jmeter.control.GenericController.fireIterEvents(GenericController.java:391) ~[ApacheJMeter_core.jar:5.5]
    at org.apache.jmeter.control.GenericController.next(GenericController.java:160) ~[ApacheJMeter_core.jar:5.5]
    at org.apache.jmeter.control.LoopController.next(LoopController.java:134) ~[ApacheJMeter_core.jar:5.5]
    at org.apache.jmeter.threads.AbstractThreadGroup.next(AbstractThreadGroup.java:99) ~[ApacheJMeter_core.jar:5.5]
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:266) ~[ApacheJMeter_core.jar:5.5]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]```

  [1]: https://jmeter-plugins.org/wiki/WebDriverSampler/
  [2]: https://i.stack.imgur.com/3ovXY.png
  [3]: https://i.stack.imgur.com/Qmso4.png
bmp9r5qi

bmp9r5qi1#

Chrome Driver Config中添加--remote-allow-origins=*

同时查看4.7.2 selenium版本,我认为您没有最新版本的WebDriver Sampler插件,因为最新的WebDriver Sampler4.8.3.1附带了Selenium 4.8.3,因此请考虑使用JMeter Plugins Manager进行升级甚至重新安装

相关问题