My company has a bunch of automated test cases for our regression sweeps made using Selenium. We would like to add load to some of them but can't figure out a viable way to do it because the data can be dynamic. Any help will be greatly appreciated. Please let me know if you need more information.

  • 1
    Do you want to (1) run your Selenium tests while the server is under load or (2) use your Selenium tests to generate load, or (3) something else?
    – user246
    Commented Jul 18, 2016 at 16:55
  • So for example, I have a manual test case that I have just automated using Selenium. I run this test case nightly to make sure it is working in the newest build. Now I'd like to run the same scenario in JMeter with the actual load. Commented Jul 18, 2016 at 19:51

3 Answers 3


Depending on the data, but jmeter can get and store variables to use, you can also set your own variables. It is quite an easy thing to do if you're familiar with basic jmeter. Here's some links on getting started:

Basic getting started with HTTP Requests

User Defined Variables

  • 1
    Thank you for the response. The info in the links you have provided will help me with a dynamic dom? From the initial look, it doesn't seem that way. Edit: I have even tried recording and running the scripts in JMeter a bunch of times. After the login step, I don't get anywhere. Nothing fails, but there is no data generated either (I.e filling out a basic form after logging in). Commented Jul 18, 2016 at 19:53
  • @hungryhippos Dynamic in what way? With Jmeter you can pretty much use the same approach to finding elements on a webpage as you do via selenium (css, xpath) Here is an example using css
    – cakes88
    Commented Jul 19, 2016 at 20:16

JMeter is made for generating load, and WebDriver is made for testing user interfaces. Neither is great for doing the other.

You can configure JMeter to talk to WebDriver -- see this tutorial -- but you cannot just drop your existing WebDriver test into JMeter; you have to rewrite it in a way that only works with JMeter.

Going the other direction, some have tried using multiple instances of WebDriver-operated browsers to generate load, but that doesn't scale.

I recommend scripting something that launches JMeter, then runs your WebDriver tests in a different process, then stops JMeter afterward.


In general, if you're asking for a "good" method, it is recommended to create the main load using JMeter HTTP Request samplers and if needed run a single threaded Selenium test in parallel to monitor end-user experience and measure page rendering time, time of JavaScript execution, etc.

If for some reason you need to stick to Selenium, first of all, have you heard about Selenium Grid?

If yes and it doesn't fit your needs - here are the options:

Depending on what programming language (Selenium client library) and xUnit framework you use for your tests you can go for following:

  • If your tests written using Java and JUnit - you can re-use them in JMeter via JUnit Request Sampler. Make sure you add all the dependency libraries to JMeter classpath. See How to Use JUnit With JMeter guide for details.

  • There is WebDriver Sampler which provides some level of Selenium integration.

  • You can invoke your tests via OS Process Sampler as well, but in that case JMeter metrics will be flaky.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.