0

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

Users9949
  • 1,819
  • 1
  • 12
  • 11

1 Answers1

0

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

JMeter WebDriver Navigation Timings

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

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • Thanks Dmitri for reply with detailed information.but when i am running the same i am getting NoClassDefFoundError.tried found root found that there is jar file missing (selenium-server-version.jar) added the same still i am getting following error.2016/06/21 23:23:36 ERROR - jmeter.threads.JMeterThread: Test failed! java.lang.NoClassDefFoundError: com/google/common/base/Function at com.blazemeter.jmeter.webdriver.phantomjs.PhantomJSDriverConfig.createBrowser(PhantomJSDriverConfig.java:77) at com.blazemeter.jmeter.webdriver.phantomjs.PhantomJSDriverConfig.threadStarted(PhantomJSDriverConfi – Users9949 Jun 21 '16 at 17:58
  • Perhaps your WebDriver Sampler plugin installation is corrupt. Try installing it using [Plugin Manager](https://www.blazemeter.com/blog/how-install-jmeter-plugins-manager) – Dmitri T Jun 21 '16 at 19:38
  • Thanks Dmitri now it is executing but WebDriverSampler does not returning any values2016/06/22 14:11:38 INFO - com.googlecode.jmeter.plugins.webdriver.sampler.WebDriverSampler: {}.is there any thing i am missing.For the Phantomjs Driver config path to Phantomjs Executables /Users/Users9949/Documents/softwares/phantomjs-1.9.7-macosx/bin/phantomjs please help me on this – Users9949 Jun 22 '16 at 08:45
  • Tried with Phantomjs version 2.1.1 it is working fine.Thanks so Much Dmitri.one More help please point me where can i get WebDriver sampler scripting examples to under more. – Users9949 Jun 23 '16 at 08:02
  • I am interested in domload and windowload tried to iterate through(tried both lenght and size()) the timings array.but it is throwing following error.2016/06/23 20:07:54 ERROR - com.googlecode.jmeter.plugins.webdriver.sampler.WebDriverSampler: sun.org.mozilla.javascript.internal.EvaluatorException: Java class "com.google.common.collect.Maps$TransformedEntriesMap" has no public instance field or method named "0". (#8) in at line number 8 please help on this.. – Users9949 Jun 23 '16 at 14:38