Jmeter webdriver 采样器 class 未找到错误
Jmeter webdriver sampler class not found error
我编写了以下 jmeter webdriver 脚本:
var pkg = JavaImporter(org.openqa.selenium) //WebDriver classes
var support_ui = JavaImporter(org.openqa.selenium.support.ui.WebDriverWait)//WebDriver classes
var timeunit = JavaImporter(java.util.concurrent.TimeUnit)
WDS.sampleResult.sampleStart()
WDS.sampleResult.getLatency()
WDS.browser.get('http://interview.erainfotechbd.com:5003/')
WDS.browser.manage().timeouts().pageLoadTimeout(30, timeunit.SECONDS)
WDS.log.info("chat bot opended")
//var name= WDS.args[0]
//var number= WDS.args[1]
WDS.log.info("names are :" +WDS.args[0])
WDS.log.info("numbers are :" +WDS.args[1])
//var wait=new support_ui.WebDriverWait(WDS.browser, 5)
WDS.browser.manage().timeouts().implicitlyWait(25, timeunit.SECONDS);
var userName = WDS.browser.findElement(pkg.By.xpath('//input[@name="nickname"]'))
userName.click(); //clicks search field
userName.sendKeys(WDS.args[0]) //types word "blazemeter" in field//saves search field into searchField
var mobileNumber = WDS.browser.findElement(pkg.By.xpath('//input[@name="mobile"]'))
mobileNumber.click();
mobileNumber.sendKeys(WDS.args[1]) //types word "blazemeter" in field//saves search field into searchField
var loginButton = WDS.browser.findElement(pkg.By.xpath('//button[@id="Enter"]'))
loginButton.click(); //clicks login button
var wait=new support_ui.WebDriverWait(WDS.browser, 5)
var selectInterview= WDS.browser.findElement(pkg.By.xpath('//form[@id="myFormInt"]/input[1]'))
selectInterview.click()
var wait=new support_ui.WebDriverWait(WDS.browser, 20)
//timeouts.pageLoadTimeout(600, timeUnit.TimeUnit.SECONDS)
var returnedAnswer=WDS.browser.findElement(pkg.By.xpath('//input[@class="form-control"]')).getText()
var enterValidNumber= WDS.browser.findElement(pkg.By.xpath('//input[@class="form-control"]'))
enterValidNumber.sendKeys('01676912613')
var sendMessagebutton= WDS.browser.findElement(pkg.By.xpath('//button[@id="sendMessage"]'))
sendMessagebutton.click()
var wait=new support_ui.WebDriverWait(WDS.browser, 20)
//timeouts.pageLoadTimeout(600, timeUnit.TimeUnit.SECONDS)
WDS.vars.put('renderTime', renderTime.toString())
WDS.sampleResult.sampleEnd()
在 运行 此脚本之后显示以下错误
WARN c.g.j.p.w.s.WebDriverSampler: Class true not found, defaulted to org.apache.jmeter.samplers.SampleResult
java.lang.ClassNotFoundException: true
at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_171]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_171]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_171]
at java.lang.Class.forName0(Native Method) ~[?:1.8.0_171]
at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_171]
at com.googlecode.jmeter.plugins.webdriver.sampler.WebDriverSampler.<init>(WebDriverSampler.java:51) ~[jmeter-plugins-webdriver-3.1.jar:?]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_171]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_171]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_171]
at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_171]
at org.apache.jmeter.testelement.AbstractTestElement.clone(AbstractTestElement.java:74) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.gui.action.CheckDirty.addNode(CheckDirty.java:157) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:994) ~[jorphan.jar:5.2.1]
at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:995) ~[jorphan.jar:5.2.1]
at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:977) ~[jorphan.jar:5.2.1]
at org.apache.jmeter.gui.action.CheckDirty.doAction(CheckDirty.java:86) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:88) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.gui.action.ActionRouter.doActionNow(ActionRouter.java:125) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.gui.action.Save.backupAndSave(Save.java:265) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.gui.action.Save.doAction(Save.java:175) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:88) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.gui.action.ActionRouter.doActionNow(ActionRouter.java:125) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.gui.action.AbstractAction.popupShouldSave(AbstractAction.java:80) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.gui.action.Start.doAction(Start.java:113) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:88) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.gui.action.ActionRouter.lambda$actionPerformed[=12=](ActionRouter.java:70) ~[ApacheJMeter_core.jar:5.2.1]
at java.awt.event.InvocationEvent.dispatch(Unknown Source) [?:1.8.0_171]
at java.awt.EventQueue.dispatchEventImpl(Unknown Source) [?:1.8.0_171]
at java.awt.EventQueue.access0(Unknown Source) [?:1.8.0_171]
at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_171]
at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_171]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_171]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) [?:1.8.0_171]
at java.awt.EventQueue.dispatchEvent(Unknown Source) [?:1.8.0_171]
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) [?:1.8.0_171]
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) [?:1.8.0_171]
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) [?:1.8.0_171]
at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [?:1.8.0_171]
at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [?:1.8.0_171]
at java.awt.EventDispatchThread.run(Unknown Source) [?:1.8.0_171]
之前是 运行 更新 chrome 后出现此错误。我也更新了 chrome 驱动程序。 chrome 以前的版本是 70,现在是 80。Chromedriver 以前的版本是 79,现在是 80。
您(或其他人)似乎试图修改 webdriver.sampleresult_class
属性 值并将其设置为 true
,这是不可接受的值。
可能的值为:
org.apache.jmeter.samplers.SampleResult
- 单样本结果
com.googlecode.jmeter.plugins.webdriver.sampler.SampleResultWithSubs
- 对于带有子结果的示例结果(树状)
因此检查 jmeter.properties
、user.properties
文件和 JMeter 启动脚本的命令行,如果您看到类似 webdriver.sampleresult_class=true
的内容 - 删除它,找到添加此值的人并杀死他或她。
参考文献:
我编写了以下 jmeter webdriver 脚本:
var pkg = JavaImporter(org.openqa.selenium) //WebDriver classes
var support_ui = JavaImporter(org.openqa.selenium.support.ui.WebDriverWait)//WebDriver classes
var timeunit = JavaImporter(java.util.concurrent.TimeUnit)
WDS.sampleResult.sampleStart()
WDS.sampleResult.getLatency()
WDS.browser.get('http://interview.erainfotechbd.com:5003/')
WDS.browser.manage().timeouts().pageLoadTimeout(30, timeunit.SECONDS)
WDS.log.info("chat bot opended")
//var name= WDS.args[0]
//var number= WDS.args[1]
WDS.log.info("names are :" +WDS.args[0])
WDS.log.info("numbers are :" +WDS.args[1])
//var wait=new support_ui.WebDriverWait(WDS.browser, 5)
WDS.browser.manage().timeouts().implicitlyWait(25, timeunit.SECONDS);
var userName = WDS.browser.findElement(pkg.By.xpath('//input[@name="nickname"]'))
userName.click(); //clicks search field
userName.sendKeys(WDS.args[0]) //types word "blazemeter" in field//saves search field into searchField
var mobileNumber = WDS.browser.findElement(pkg.By.xpath('//input[@name="mobile"]'))
mobileNumber.click();
mobileNumber.sendKeys(WDS.args[1]) //types word "blazemeter" in field//saves search field into searchField
var loginButton = WDS.browser.findElement(pkg.By.xpath('//button[@id="Enter"]'))
loginButton.click(); //clicks login button
var wait=new support_ui.WebDriverWait(WDS.browser, 5)
var selectInterview= WDS.browser.findElement(pkg.By.xpath('//form[@id="myFormInt"]/input[1]'))
selectInterview.click()
var wait=new support_ui.WebDriverWait(WDS.browser, 20)
//timeouts.pageLoadTimeout(600, timeUnit.TimeUnit.SECONDS)
var returnedAnswer=WDS.browser.findElement(pkg.By.xpath('//input[@class="form-control"]')).getText()
var enterValidNumber= WDS.browser.findElement(pkg.By.xpath('//input[@class="form-control"]'))
enterValidNumber.sendKeys('01676912613')
var sendMessagebutton= WDS.browser.findElement(pkg.By.xpath('//button[@id="sendMessage"]'))
sendMessagebutton.click()
var wait=new support_ui.WebDriverWait(WDS.browser, 20)
//timeouts.pageLoadTimeout(600, timeUnit.TimeUnit.SECONDS)
WDS.vars.put('renderTime', renderTime.toString())
WDS.sampleResult.sampleEnd()
在 运行 此脚本之后显示以下错误
WARN c.g.j.p.w.s.WebDriverSampler: Class true not found, defaulted to org.apache.jmeter.samplers.SampleResult
java.lang.ClassNotFoundException: true
at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_171]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_171]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_171]
at java.lang.Class.forName0(Native Method) ~[?:1.8.0_171]
at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_171]
at com.googlecode.jmeter.plugins.webdriver.sampler.WebDriverSampler.<init>(WebDriverSampler.java:51) ~[jmeter-plugins-webdriver-3.1.jar:?]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_171]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_171]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_171]
at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_171]
at org.apache.jmeter.testelement.AbstractTestElement.clone(AbstractTestElement.java:74) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.gui.action.CheckDirty.addNode(CheckDirty.java:157) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:994) ~[jorphan.jar:5.2.1]
at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:995) ~[jorphan.jar:5.2.1]
at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:977) ~[jorphan.jar:5.2.1]
at org.apache.jmeter.gui.action.CheckDirty.doAction(CheckDirty.java:86) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:88) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.gui.action.ActionRouter.doActionNow(ActionRouter.java:125) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.gui.action.Save.backupAndSave(Save.java:265) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.gui.action.Save.doAction(Save.java:175) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:88) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.gui.action.ActionRouter.doActionNow(ActionRouter.java:125) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.gui.action.AbstractAction.popupShouldSave(AbstractAction.java:80) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.gui.action.Start.doAction(Start.java:113) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:88) ~[ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.gui.action.ActionRouter.lambda$actionPerformed[=12=](ActionRouter.java:70) ~[ApacheJMeter_core.jar:5.2.1]
at java.awt.event.InvocationEvent.dispatch(Unknown Source) [?:1.8.0_171]
at java.awt.EventQueue.dispatchEventImpl(Unknown Source) [?:1.8.0_171]
at java.awt.EventQueue.access0(Unknown Source) [?:1.8.0_171]
at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_171]
at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_171]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_171]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) [?:1.8.0_171]
at java.awt.EventQueue.dispatchEvent(Unknown Source) [?:1.8.0_171]
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) [?:1.8.0_171]
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) [?:1.8.0_171]
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) [?:1.8.0_171]
at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [?:1.8.0_171]
at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [?:1.8.0_171]
at java.awt.EventDispatchThread.run(Unknown Source) [?:1.8.0_171]
之前是 运行 更新 chrome 后出现此错误。我也更新了 chrome 驱动程序。 chrome 以前的版本是 70,现在是 80。Chromedriver 以前的版本是 79,现在是 80。
您(或其他人)似乎试图修改 webdriver.sampleresult_class
属性 值并将其设置为 true
,这是不可接受的值。
可能的值为:
org.apache.jmeter.samplers.SampleResult
- 单样本结果com.googlecode.jmeter.plugins.webdriver.sampler.SampleResultWithSubs
- 对于带有子结果的示例结果(树状)
因此检查 jmeter.properties
、user.properties
文件和 JMeter 启动脚本的命令行,如果您看到类似 webdriver.sampleresult_class=true
的内容 - 删除它,找到添加此值的人并杀死他或她。
参考文献: