我正在开发一个Jmeter beanshell脚本来与Selenium一起工作。我决定使用beanshell取样器,这样我就可以使用WDS界面中无法访问的java和selenium命令。JMETER Beanshell(java.lang.String)在类
我的代码工作正常,除了一些字符串输入。下面是一个示例(推倒准系统):
import org.openqa.selenium.chrome.ChromeOptions;
ChromeOptions options = new ChromeOptions();
options.addArguments("start-maximized");
和我得到这个错误
2017/03/31 13:43:21 ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import org.openqa.selenium.chrome.ChromeOptions; debug(); ChromeOptions options . . . '' : Error in method invocation: Method addArguments(java.lang.String) not found in class'org.openqa.selenium.chrome.ChromeOptions' 2017/03/31 13:43:21 WARN - jmeter.protocol.java.sampler.BeanShellSampler: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import org.openqa.selenium.chrome.ChromeOptions; debug(); ChromeOptions options . . . '' : Error in method invocation: Method addArguments(java.lang.String) not found in class'org.openqa.selenium.chrome.ChromeOptions' 201
我看到这个像的SendKeys其他一些命令类似。
为什么这个命令没有使用我的字符串?我可以运行完整的脚本和浏览器打开文件,所以我知道硒与Jmeter设置。这只是使用字符串的某些命令来执行此操作。
感谢 Ĵ
您究竟如何将Selenium类添加到JMeter类路径中? –
它不会工作,除非你正确映射硒罐。我建议你使用网络驱动程序取样器。 Beanshell不容易获得更好的性能。 –