博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
JMeter运行通过Chrome打开的website
阅读量:6969 次
发布时间:2019-06-27

本文共 2391 字,大约阅读时间需要 7 分钟。

部分website在chrome上运行正常,但在IE环境运行会存在问题。而是用 JMeter运行通过chrome打开的website时候,需要处理一下。

可以参考下面几篇文章:

摘录部分要点信息如下:

Once download finished, extract zip archive somewhere temporary. Then open the folder where your JMeter located, navigate to ..\apache-jmeter-2.13\lib and paste all .jar files from WebDriver plugin ..\lib. Open ..\apache-jmeter-2.13\lib\ext and paste .jar file from WebDriver plugin ..\lib\ext.

Right click on a Test Plan => Add => Threads => Config Element => and make verify is presented Chrome Driver Config.

Now lets set the project:

1. Add Thread Group

2. Then Chrome Driver Config (right click on Thread Group => Add => Config Element => Chrome Driver Config)

You would need to specify location of chromedriver.exe (btw download it, if you haven't yet), then open Chrome Driver Config and switch to Chrome tab and add path, it would be something like:

C:\Users\your_username\apache-jmeter-2.13\lib\chromedriver.exe

3. Add WebDriver Sampler (right click on Thread Group => Add => Sampler => WebDriver Sampler)

And add some test code:

var webdriver = JavaImporter(org.openqa.selenium)var support_ui = JavaImporter(org.openqa.selenium.support.ui.WebDriverWait)var conditions = org.openqa.selenium.support.ui.ExpectedConditionsvar wait=new support_ui.WebDriverWait(WDS.browser, 5)var exception = nullWDS.sampleResult.sampleStart()WDS.browser.get('localhost:8080')var loginUrl = WDS.browser.findElement(webdriver.By.id('loginUrl_id'))loginUrl.click()var userName = WDS.browser.findElement(webdriver.By.id('username_id'))userName.sendKeys('admin')var password = WDS.browser.findElement(webdriver.By.id('password_id'))password.sendKeys('9')var loginBtn = WDS.browser.findElement(webdriver.By.id('loginBtn_id'))loginBtn.click()var wait=new support_ui.WebDriverWait(WDS.browser, 10)wait.until(conditions.presenceOfElementLocated(webdriver.By.linkText('Some Link Text')))

Run the tests!

You might have an error message like that on first run

2015/08/04 13:41:37 ERROR - jmeter.threads.JMeterThread: Test failed! java.lang.NoClassDefFoundError: Could not initialize class org.apache.http.impl.conn.ManagedHttpClientConnectionFactory

Then problem is duplicate files in your lib folder, so if problem appear open JMeter lib folder and make sure there is no duplicates.

like this:

Here is original .

For more information check out Blazemeter posts

1. 
2. 

 

另外,下面这两篇文章基本是源自前一篇文章,如果觉得有必要,也可以参考:

 

就这样处理即可;

转载地址:http://htisl.baihongyu.com/

你可能感兴趣的文章
浏览器兼容之旅的第一站:如何创建条件样式
查看>>
docker swarm英文文档学习-5-在swarm模式中运行Docker引擎
查看>>
利用NX Open在NX中创建点并获取点的坐标信息在listing_windows中输出
查看>>
【Erlang新手成长日记】JSON编码与解码
查看>>
Linux下安装tomcat和jdk
查看>>
实验四+065+方绎杰
查看>>
js中函数作用域,作用域链,变量提升
查看>>
c/c++ sizeof运算符详解以及对象大小
查看>>
HDU2046 骨牌铺方格【递推】
查看>>
第二个spring,第一天
查看>>
问题集录--从初级java程序员到架构师,从小工到专家
查看>>
CSS3自定义滚动条样式 -webkit-scrollbar(转)
查看>>
VC下动态数据交换技术
查看>>
docker容器的分层思想
查看>>
决策树
查看>>
【转】app瘦身
查看>>
拓扑排序
查看>>
【转】获取Windows系统明文密码神器
查看>>
Rhel6-keepalived+lvs配置文档
查看>>
Paint.FontMetrics
查看>>