我想通过 JMeter 打开 EDGE 浏览器。所有其他浏览器在JMeter中都有特定的配置元素。但是Edge没有任何&我想使用edge浏览器。
2 回答
目前WebDriver Sampler 插件不支持 Edge 浏览器,您可以联系 JMeter Plugins 开发人员和维护人员并澄清路线图上的功能以及是否/何时实施。
与此同时,您仍然可以使用JSR223 Sampler和Groovy语言从 JMeter 启动 Edge 浏览器
确保安装JMeter WebDriver 插件。以下说明假设Selenium/WebDriver 支持插件版本 3.0,它可以使用JMeter Plugins Manager安装:
- 下载
selenium-edge-driver-3.14.0.jar
并将其存储在 JMeter 安装的“lib”文件夹下 - 下载
MicrosoftWebDriver.exe
您的 Edge 版本并将其放在 JMeter 安装的“lib”文件夹下 - 重新启动 JMeter 以拾取 .jar
- 将 JSR223 采样器添加到您的测试计划中
将以下代码放入“脚本”区域:
System.setProperty("webdriver.edge.driver", "../lib/MicrosoftWebDriver.exe"); def driver = new org.openqa.selenium.edge.EdgeDriver() driver.get("http://jmeter.apache.org")
- 就是这样,JMeter应该启动Edge浏览器并打开JMeter网站
Updated: To invoke the EDGE browser through a WebDriver in JMeter follow this steps:
- Download Microsoft Edge WebDriver
- Install JMeter-Plugins
- Add
jp@gc - WebDriver Sampler
to your test plan - Add
jp@gc - Internet Explorer Driver Config
to your test plan - Choose
Internet Explorer Driver Config
and open anInternet Explorer
tab - Specify the path to the EDGE WebDriver in the appropriate field
- Save and Run your test - EDGE browser will be launched!
Also you may just simulate EDGE browser without WebDriver
- Add HTTP Header Manager
- Add
User-Agent
header with one of Edge User Agent strings to HTTP Header Manager
Some strings for example, chhose nay one to simulate EDGE:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586
User-agent strings for Microsoft Edge
Microsoft Edge for desktop and mobile in Windows 10 and RemoteIE builds is designed for maximum interoperability with other modern browsers and contemporary web content. The desktop, mobile, and WebView user-agent strings are below.
Desktop:
Mozilla/5.0 (Windows NT 10.0; <64-bit tags>) AppleWebKit/<WebKit Rev> (KHTML, like Gecko) Chrome/<Chrome Rev> Safari/<WebKit Rev> Edge/<EdgeHTML Rev>.<Windows Build>
Mobile
Mozilla/5.0 (WM 10.0; Android <Android Version>; <Device Manufacturer>; <Device Model>) AppleWebKit/<WebKit Rev> (KHTML, like Gecko) Chrome/<Chrome Rev> Mobile Safari/<WebKit Rev> Edge/<EdgeHTML Rev>.<Windows Build>