Key takeaways

  • The WebDriver Sampler measures real browser rendering, which HTTP samplers cannot see.
  • Each browser instance is expensive, so use a small number alongside a larger HTTP load.
  • Use it to measure front-end timing, not to generate volume.

Is Your Infrastructure Ready for Global Traffic Spikes?

Unexpected load surges can disrupt your services. With LoadFocus’s cutting-edge Load Testing solutions, simulate real-world traffic from multiple global locations in a single test. Our advanced engine dynamically upscales and downscales virtual users in real time, delivering comprehensive reports that empower you to identify and resolve performance bottlenecks before they affect your users.

View Pricing
Real-time insights
Discover More
Global scalability
Here is how to use Apache JMeter’s WebDriver Sampler to load test the UI of the application, and by the UI, I mean load test a user’s workflow, with entering the web pages, clicking on different links etc.
All you have to do is install the JMeter plugins and make use of the WebDriver Config and WebDriver Sampler plugins which will offer this capability.
Let’s go into more detail and see how to load test an app with Apache JMeter’s WebDriver Sampler.
Here are the steps to Load Test the UI:
  • Add a Chrome Driver Config

      • choose if you want to create a new Browser at the start of each iteration (if you don’t tick this option, the browser instances are going to be reused per each thread, which will cache some of the assets, requests)

  • Add a WebDriver Sampler

      • add the following code which will monitor the load time for loading the following webpage https://www.example.com?uid=${token}


WDS.sampleResult.sampleStart()
WDS.browser.get('https://www.example.com?uid=${token}')
WDS.sampleResult.sampleEnd()
      • the token variable is previously generate by an HTTP POST request
      • imagine the scenario where you first have to authenticate in order to access a webpage, this is what we do
          • generate a token with an HTTP POST request
          • extract the token from the HTTP POST response

open the webpage with the token as a query parameter and monitor the load time

    • add an Aggregate Report in order to measure the load testing metrics like number of samples, response times, errors, throughput
    • add the Listeners from the JMeter Plugins: Response Times Over Time, Hits per Second and Active Threads Over Time to better understand the behaviour of your application while running the load test of the UI

Run the test at the beginning with only 1 thread in parallel, to create the baseline. The you can increase the number of threads (parallel users) to find performance bottlenecks. Here are more details on performance testing vs load testing.

To test APIs or websites that use Auth, you can checkout our article on How to Test OAuth Secured APIs & Apps using JMeter.
Hope this helps.

Think your website can handle a traffic spike?

Fair enough, but why leave it to chance? Uncover your website’s true limits with LoadFocus’s cloud-based Load Testing for Web Apps, Websites, and APIs. Avoid the risk of costly downtimes and missed opportunities—find out before your users do!

Effortless setup No coding required

Frequently Asked Questions

What does the WebDriver Sampler add?

Real browser rendering. HTTP samplers measure the server response and never execute JavaScript, so anything that happens in the browser is invisible to them.

Can I generate load with it?

Not much. Each browser instance is expensive, so run a small number of them alongside a larger HTTP-based load rather than trying to produce volume this way.

What is it best used for?

Measuring front-end timing under load: what the page actually does for a user while the system is busy, rather than how quickly the server replied.

LoadFocus is an all-in-one Cloud Testing Platform for Websites and APIs for Load Testing, Apache JMeter Load Testing, Page Speed Monitoring and API Monitoring!

Effortless setup No coding required

Related reading

Bogdan
Founder at LoadFocus

Bogdan builds and runs the tools this blog is about. He writes from what the products actually do in production, including the parts that break.

How fast is your website? Free Website Speed Test