2

我想通过 JMeter 打开 EDGE 浏览器。所有其他浏览器在JMeter中都有特定的配置元素。但是Edge没有任何&我想使用edge浏览器。

4

2 回答 2

2

目前WebDriver Sampler 插件不支持 Edge 浏览器,您可以联系 JMeter Plugins 开发人员和维护人员并澄清路线图上的功能以及是否/何时实施。

与此同时,您仍然可以使用JSR223 SamplerGroovy语言从 JMeter 启动 Edge 浏览器

  1. 确保安装JMeter WebDriver 插件。以下说明假设Selenium/WebDriver 支持插件版本 3.0,它可以使用JMeter Plugins Manager安装:

    在此处输入图像描述

  2. 下载selenium-edge-driver-3.14.0.jar并将其存储在 JMeter 安装的“lib”文件夹下
  3. 下载MicrosoftWebDriver.exe您的 Edge 版本并将其放在 JMeter 安装的“lib”文件夹下
  4. 重新启动 JMeter 以拾取 .jar
  5. 将 JSR223 采样器添加到您的测试计划中
  6. 将以下代码放入“脚本”区域:

    System.setProperty("webdriver.edge.driver", "../lib/MicrosoftWebDriver.exe");
    def driver = new org.openqa.selenium.edge.EdgeDriver()
    driver.get("http://jmeter.apache.org")    
    
  7. 就是这样,JMeter应该启动Edge浏览器并打开JMeter网站
于 2019-02-04T11:03:59.673 回答
1

Updated: To invoke the EDGE browser through a WebDriver in JMeter follow this steps:

  1. Download Microsoft Edge WebDriver
  2. Install JMeter-Plugins
  3. Add jp@gc - WebDriver Sampler to your test plan
  4. Add jp@gc - Internet Explorer Driver Config to your test plan
  5. Choose Internet Explorer Driver Config and open an Internet Explorer tab
  6. Specify the path to the EDGE WebDriver in the appropriate field
  7. Save and Run your test - EDGE browser will be launched!

enter image description here

Also you may just simulate EDGE browser without WebDriver

  1. Add HTTP Header Manager
  2. 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>

Microsoft EDGE User-agent string changes

于 2019-02-01T09:22:18.330 回答