Skip to content

Selenium WebDriver

Virtual users simulating Real-browser interactions can be created with the new Selenium WebDriver option. While JMeter virtual users are simulating user activity by sending http requests, WebDriver virtual users are simulating real browser interactions.

Running real-browser virtual users along with regular JMeter virtual users allows to capture real-user experience performance metrics.

Selenium Recording

The Selenium IDE is perfectly suited for recording Selenium scripts. It allows to record browser user interactions directly within Firefox.

Selenium IDE

For more information explaining how to record or write Selenium scripts, please take a look at the Selenium documentation.

Create Virtual User: WebDriver

Simply enter the URLs you want your virtual user to visit:

Create Virtual User from URLs

You need to enter valid URLs and include the protocol (I.e.

Import Selenium Script

To import an existing selenium script, follow the procedure above to create a sample virtual user. Then, replace the generated script by your own Selenium WebDriver script.

Script edition

Once the virtual user is created, the virtual user contains a WebDriver action with a sample Selenium script.

Selenium Sample Script

Scripts can be added, edited or removed. A Selenium Web Driver virtual user cannot mix WebDriver scripts with regular HTTP requests for performance reasons.

Advanced script example

This script is a more advanced example created on our demonstration application:

import openqa.selenium.OutputType.*;
import org.openqa.selenium.*;

// Required to start counting time which will get reported at the end of this code.

// Load the login page

// Entering login and password
WDS.browser.findElement("username")).sendKeys( new String[] { "user1" } );
WDS.browser.findElement("password")).sendKeys( new String[] { "pass1" } );
WebElement signon = WDS.browser.findElement("signon"));;

//Waiting for the logout link to appear as confirmation
WebDriverWait waitLogin = new WebDriverWait(WDS.browser, 30);
waitLogin.until(ExpectedConditions.elementToBeClickable(By.linkText("Sign Out")));

// End the test sampler, capturing length of time for the test.