1.下载JMeterPlugins-WebDriver-1.1.2
2.将JMeterPlugins-WebDriver-1.1.2libext中的*.jar拷贝到D:apache-jmeter-2.13libext下。
3.重启jmeter
4.添加插件配置元件jp@gc - Firefox Driver Config,添加chromedriver.exe的路径
5.添加sample jp@gc - Web Driver Sampler
6.取样器中写代码:如
try{
WDS.browser.get('http://www.baidu.com')
var pkg = JavaImporter(org.openqa.selenium, org.openqa.selenium.support.ui)
WDS.browser.findElement(By.className("btnDownload")).click(); //点击按钮
} catch(ex) {
WDS.log.error(ex)
WDS.sampleResult.successful = false
WDS.sampleResult.sampleEnd()
}