如何在 Jmeter Webdriver 采样器中使用 chromeoption 和desirablecapabilities? [英] How to use chromeoption and desirecapabilities in Jmeter Webdriver sampler?

查看:23
本文介绍了如何在 Jmeter Webdriver 采样器中使用 chromeoption 和desirablecapabilities?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有 chrome 浏览器的 Jmeter webdriver 采样器.我需要在 jmeter 中使用 chromeoption 和希望功能.我如何编码以使用这些选项.

I am using Jmeter webdriver sampler with chrome-browser. I need to use chromeoption and desire capability in jmeter. How to I code to use those options.

我想使用的示例代码可以是这个.

example code which I want to use can be this.

ChromeOptions options = new ChromeOptions();
options.addArguments(new String[] {"window-size=12000,10000"});
DesiredCapabilities cap = DesiredCapabilities.chrome();
cap.setCapability(ChromeOptions.CAPABILITY, options);

有人可以帮忙吗.

推荐答案

ChromeDriverConfig.java 您目前无法使用 WebDriver Sampler 所以选项在:

Looking into ChromeDriverConfig.java it isn't something you can currently control with the WebDriver Sampler so the options are in:

  1. Patch ChromeDriverConfig 源代码并根据需要修改 ChromeOptions 和 DesiredCapabilities 的初始化.完成后,您需要重新构建插件并将其放入 JMeter 安装的lib/ext"文件夹中.
  2. 切换到 JSR223 Sampler,您可以在其中完全控制 WebDriver实例(但是您需要注意启动和停止它、使用空闲端口等).与 JSR223 Sampler 一起使用的推荐语言是 Groovy
  1. Patch ChromeDriverConfig source code and amend initialization of the ChromeOptions and DesiredCapabilities according to your needs. Once done you will need to re-build the plugin and put it to "lib/ext" folder of your JMeter installation.
  2. Switch to JSR223 Sampler where you will have full control of the WebDriver instance (however you will need to take care about starting and stopping it, using free ports, etc.). The recommended language for using with JSR223 Sampler is Groovy

这篇关于如何在 Jmeter Webdriver 采样器中使用 chromeoption 和desirablecapabilities?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆