Collecting client side Performance Metrics from Phantomjs through Jmeter

前端 未结 1 433
猫巷女王i
猫巷女王i 2021-01-26 05:11

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

相关标签:
1条回答
  • 2021-01-26 05:42

    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

    0 讨论(0)
提交回复
热议问题