WebDriver Sampler in JMeter

August 11, 2017
6 mins
Share this post

Up to this point, performance testing has been on the server side of things, as JMeter does not include the time needed to render the response, nor does it process any client code, for example, JavaScript. Things that add to the overall browser execution time may include:

Some of the new and noteworthy changes are:

  1. Client-side JavaScript execution - e.g., AJAX, JS templates, etc.
  2. CSS transforms - e.g., 3D matrix transforms, animations, etc.
  3. 3rd party plugins - e.g., youtube, Double click ads, site analytics, etc.

Hopefully, the JMeter eco-system is very rich, so there is a solution for this; we will use the WebDriver Sampler in JMeter, as this sampler automates the execution and collection of performance metrics on the client-side.

Get the WebDriver Sampler

Also, we need to install the browser driver plugins of JMeter to run the test on the particular browser, like jp@gc - Chrome Driver Config, jp@gc - Firefox Driver Config, etc.

Configuration of the WebDriver Sampler test:

1. Add a Thread Group to the Test Plan and add HTTP Cookie Manager, jp@gc - Firefox Driver Config (from Config Element), jp@gc - WebDriver Sampler (from Sampler) to the Thread Group and a listener. View Results in the Table.

2. Write/Add the code in the WebDriver Sampler that you want to test. Here is the sample code, where it says to open the www.frugaltesting.com website and get its load time of it:WDS.sampleResult.sampleStart()
WDS.browser.get('https://www.frugaltesting.com')
WDS.sampleResult.sampleEnd()

FrugalTesting blog on webdriver sampler in Jmeter

3. Now when we hit the play button, JMeter will open a Firefox browser and search www.frugaltesting.com site and end the test as browser closes automatically after performing the actions according to the script (sample script) in the Web Driver Sampler.

4. We can see the sample result in the View Result Table.

FrugalTesting blog on webdriver sampler in Jmeter

Configuration of WebDriver Sampler test:

1. The reader should be prudent in the number of threads they will create as each thread will have a single browser instance associated with it.

2. As each browser consumes a significant amount of resources, so a limit should be placed on how many browsers the user should create.

FrugalTesting is one stop solution for all your testing challenges. Take your first free Load test here!

Read on to know more about Apache JMeter.

Rupesh Garg
Author
Our blog

Latest blog posts

Discover the latest in software testing: expert analysis, innovative strategies, and industry forecasts
Testing Tools

Top 5 Bug Tracking Tools for Project Management

Rupesh Garg
Rupesh Garg
November 22, 2024
5 min read
Software Testing

Exploring Advanced Scripting Techniques in BlazeMeter for Complex Load Scenarios

Rupesh Garg
Rupesh Garg
November 21, 2024
5 min read
API Testing

Step-by-Step Guide: Setting Up Postman for Flawless GraphQL Testing

Rupesh Garg
Rupesh Garg
November 21, 2024
5 min read