Collecting client side Performance Metrics from Phantomjs through Jmeter

北慕城南 提交于 2019-12-02 15:03:53

问题


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.

Thanks


回答1:


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.

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()

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



来源:https://stackoverflow.com/questions/37922398/collecting-client-side-performance-metrics-from-phantomjs-through-jmeter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!