使用jmeter的无头浏览器

使用jmeter的无头浏览器,jmeter,jmeter-plugins,Jmeter,Jmeter Plugins,我试着用(jp@gc-HtmlUnit Driver Config)使用jmeter创建无头浏览器测试,但我得到了这个错误 响应消息:com.gargoylesoftware.htmlunit.ScriptException:ReferenceError:“getComputedStyle”未定义 我在网上读到,它建议jp@gc-HtmlUnit驱动程序配置不支持javascript。有没有办法通过jmeter解决这个问题?或者是否有其他选项可以进行无头浏览器测试。我有linux服务器作为负载注

我试着用(jp@gc-HtmlUnit Driver Config)使用jmeter创建无头浏览器测试,但我得到了这个错误

响应消息:com.gargoylesoftware.htmlunit.ScriptException:ReferenceError:“getComputedStyle”未定义

我在网上读到,它建议jp@gc-HtmlUnit驱动程序配置不支持javascript。有没有办法通过jmeter解决这个问题?或者是否有其他选项可以进行无头浏览器测试。我有linux服务器作为负载注入器

更新:

我有一个网络驱动采样器打开谷歌网页

WDS.sampleResult.sampleStart()WDS.browser.get(“”) WDS.sampleResult.sampleEnd()

下载了Phanton JS,但当我运行它时,它在报告中没有显示任何内容。我应该添加任何其他配置吗


HtmlUnit不太支持JS

我做了很多测试并使用了每一个,我可以说,PHANTOMJS是所有JS/CSS的最佳支持。。。有一个漂亮的渲染器,有漂亮的屏幕截图。 通过代码,您可以像这样使用它(您可以从这里下载它(phantomjs-1.9.8非常稳定)):

如果您想通过JMeter GUI实现这一点,您需要在
逻辑控制器
之前添加元素
JSR223采样器
在脚本面板中:

org.openqa.selenium.Capabilities caps = new org.openqa.selenium.remote.DesiredCapabilities();
        ((org.openqa.selenium.remote.DesiredCapabilities) caps).setJavascriptEnabled(true);
        ((org.openqa.selenium.remote.DesiredCapabilities) caps).setCapability("takesScreenshot", true);
        ((org.openqa.selenium.remote.DesiredCapabilities) caps).setCapability(
                org.openqa.selenium.phantomjs.PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY,
                "your custom path\\phantomjs.exe");
        org.openqa.selenium.WebDriver driver = new org.openqa.selenium.phantomjs.PhantomJSDriver(caps);
        org.apache.jmeter.threads.JMeterContextService.getContext().getCurrentSampler().getThreadContext()
                .getVariables().putObject(com.googlecode.jmeter.plugins.webdriver.config.WebDriverConfig.BROWSER, driver);

如果您需要更多信息,请不要犹豫。

我发现有一个新的插件可以执行此操作,我认为这是插件或libs的问题,你能用JSR223采样器试试我的建议吗?我已经从上图中的phanton值中删除了单引号。查看日志,我看到错误java.lang.NoClassDefFoundError:org/openqa/selenium/os/Kernel32位于org.openqa.selenium.os.ProcessUtils.killWinProcess(ProcessUtils.java:133)位于org.openqa.selenium.os.ProcessUtils.killProcess(ProcessUtils.java:81)
org.openqa.selenium.Capabilities caps = new org.openqa.selenium.remote.DesiredCapabilities();
        ((org.openqa.selenium.remote.DesiredCapabilities) caps).setJavascriptEnabled(true);
        ((org.openqa.selenium.remote.DesiredCapabilities) caps).setCapability("takesScreenshot", true);
        ((org.openqa.selenium.remote.DesiredCapabilities) caps).setCapability(
                org.openqa.selenium.phantomjs.PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY,
                "your custom path\\phantomjs.exe");
        org.openqa.selenium.WebDriver driver = new org.openqa.selenium.phantomjs.PhantomJSDriver(caps);
        org.apache.jmeter.threads.JMeterContextService.getContext().getCurrentSampler().getThreadContext()
                .getVariables().putObject(com.googlecode.jmeter.plugins.webdriver.config.WebDriverConfig.BROWSER, driver);