我根据网上的一个简单示例编写了 JMeter - Webdriver 测试。负载测试应加载 Chrome 并打开特定页面。 Chrome打开,但页面未显示,jmeter返回错误。
这些是规格:
os.name: 'Windows Server 2012 R2', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_144'
Chrome version: 65 and higher versions
Jmeter: 5.1.1, selenium-chrome-driver-3.14.0.jar,selenium-java-3.14.0.jar
Thread Group
jp@gc - Chrome Driver Config
path to Chrome driver : C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
jp@gc - WebDriver Sampler
WDS.sampleResult.sampleStart()
WDS.browser.get('http://www.jmeter-plugins.org')
WDS.sampleResult.sampleEnd()
我期望在Chrome中查看页面,只打开了Chrome,但没有加载具体页面。
感谢您花时间帮助我解决问题。
JMeter 日志错误:
Driver info: driver.version: unknown
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:193) ~[selenium-remote-driver-3.14.0.jar:?]
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:179) ~[selenium-remote-driver-3.14.0.jar:?]
at com.googlecode.jmeter.plugins.webdriver.config.ChromeDriverConfig.getThreadService(ChromeDriverConfig.java:93) ~[jmeter-plugins-webdriver-3.0.jar:?]
at com.googlecode.jmeter.plugins.webdriver.config.ChromeDriverConfig.createBrowser(ChromeDriverConfig.java:73) ~[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.1 r1855137]
at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:994) [jorphan.jar:5.1.1 r1855137]
at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:977) [jorphan.jar:5.1.1 r1855137]
at org.apache.jmeter.threads.JMeterThread.threadStarted(JMeterThread.java:730) [ApacheJMeter_core.jar:5.1.1 r1855137]
at org.apache.jmeter.threads.JMeterThread.initRun(JMeterThread.java:718) [ApacheJMeter_core.jar:5.1.1 r1855137]
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:249) [ApacheJMeter_core.jar:5.1.1 r1855137]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_144]
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:20883/status] to be available after 20002 ms
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100) ~[selenium-remote-driver-3.14.0.jar:?]
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:188) ~[selenium-remote-driver-3.14.0.jar:?]
... 13 more
Caused by: java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_144]
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:156) ~[guava-25.0-jre.jar:?]
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75) ~[selenium-remote-driver-3.14.0.jar:?]
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:188) ~[selenium-remote-driver-3.14.0.jar:?]
... 13 more
2019-05-08 11:20:03,732 ERROR o.a.j.t.JMeterThread: Error while processing sampler: 'jp@gc - WebDriver Sampler'.
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.1 r1855137]
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:546) ~[ApacheJMeter_core.jar:5.1.1 r1855137]
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:486) [ApacheJMeter_core.jar:5.1.1 r1855137]
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:253) [ApacheJMeter_core.jar:5.1.1 r1855137]
请根据您的浏览器版本从以下链接下载 chrome 驱动程序,如果不可用,请更新 chrome 浏览器:-
http://chromedriver.chromium.org/downloads
获得“chromedriver.exe”后,更改 Chrome 驱动程序配置中的路径 jp@gc - Chrome 驱动程序配置
ex:- Chrome 驱动程序的路径:D:\ChromeDrive