本文介绍了通过Jmeter从Phantomjs收集客户端性能指标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在整个PhantonJS驱动程序配置中,我们都可以通过使用Jmeter DomLoad windLoad ResourceCount资源大小通过phantomjs捕获以下客户端性能指标.

Throughout PhantonJS Driver Config is there any way we can capture the following client-side performance metrics through phantomjs by using Jmeter DomLoad windLoad ResourceCount Resource size.

谢谢

推荐答案

我建议使用允许执行任意JavaScript代码的WDS.browser.executeScript()方法捕获指标.完成后,您可以将有趣的"值直接存储到JMeter变量中以备后用.

I would recommend capturing the metrics using WDS.browser.executeScript() method which allows executing arbitrary JavaScript code. Once done you can directly store "interesting" values into JMeter Variables for later use.

以下是使用导航API 来获取有关页面加载的扩展信息的示例:

Here is an example of using Navigation API to get extended information on page loading:

WDS.sampleResult.sampleStart()
WDS.browser.get('http://jmeter-plugins.org')
var timings = WDS.browser.executeScript('var performance = window.performance || window.webkitPerformance || window.mozPerformance || window.msPerformance || {}; var timings = performance.timing || {}; return timings;');
WDS.log.info(timings)
WDS.sampleResult.sampleEnd()

请参见 WebDriver采样器:您的十大问题已回答 WebDriver Sampler提示和技巧的指南

See The WebDriver Sampler: Your Top 10 Questions Answered guide for WebDriver Sampler tips and tricks

这篇关于通过Jmeter从Phantomjs收集客户端性能指标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 10:17