DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • The Cypress Edge: Next-Level Testing Strategies for React Developers
  • Solid Testing Strategies for Salesforce Releases
  • Why We Still Struggle With Manual Test Execution in 2025
  • Why Testing is a Long-Term Investment for Software Engineers

Trending

  • Why We Still Struggle With Manual Test Execution in 2025
  • Evolution of Cloud Services for MCP/A2A Protocols in AI Agents
  • Unlocking AI Coding Assistants Part 1: Real-World Use Cases
  • A Developer's Guide to Mastering Agentic AI: From Theory to Practice
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Testing, Tools, and Frameworks
  4. Performance Test With Selenium

Performance Test With Selenium

In case you have your automated integration test, why not use Selenium as a performance test script?

By 
Canberk Akduygu user avatar
Canberk Akduygu
·
Dec. 26, 18 · Tutorial
Likes (7)
Comment
Save
Tweet
Share
43.5K Views

Join the DZone community and get the full member experience.

Join For Free

Selenium WebDriver is an automation tool for web applications. It can operate on Chrome, Firefox, Safari, Internet Explorer, and many other browsers via its driver ecosystem.  JMeter, on the other hand, is a Java-based performance testing tool. They are both open-source, defacto tools for testing teams. In case you have your automated integration test, why not use them as a performance test script?

JMeter has a WebDriver plugin to support Selenium based scripting. You can download this plugin by JMeter Plugin Manager.

JMeter supports running your test via Chrome, Firefox, and Internet Explorer. Therefore, you need to download Chrome, Firefox, and Internet Explorer driver binaries.

  • Chrome driver binary can be downloaded via http://chromedriver.chromium.org/
  • Firefox GeckoDriver can be download via https://github.com/mozilla/geckodriver/releases

Let’s create our first test.

Step 1: Create a Browser Configuration

Create a Thread Group and add “Chrome Driver Config” from Config Elements menu.

Then, you need to give downloaded Chromedriver binary as a path to your Config Element.

Step 2: Implement Your Test

Add WebDriver Sampler under the Thread Group. This will bring a basic script, which opens a web page. We need to manipulate this script.

In order to interact with the browser, you need to use Selenium specific methods, like  sendKeys,  click(), etc.

Here are some tips:

Browse Open Command

This command opens the provided URL

WDS.browser.get(‘http://www.google.com‘);


In order to do some UI specific action, you need to import org.openqa.selenium package to your script. Just add this line to your script.

var pkg = JavaImporter(org.openqa.selenium);


SendKeys Command

If you are familiar with Selenium, you know that you can reach element by cssSelector, id, XPath etc.. pkg variable that we created, which helps you find the web element.  This is how you find an element. You store the webElement into a variable called searchField.

var searchField =

WDS.browser.findElement(pkg.By.cssSelector(‘input[name=\’q\’]’));


Then, you just use the standard Selenium function sendKeys to write some text.

searchField.sendKeys([‘loadium’]);


Click Command

Selenium has a built-in click command. You just use the same function after acquiring the webElement. First, we store the element and perform the click operation.

var searchButton =

WDS.browser.findElement(pkg.By.cssSelector(‘button[name=\’btnK\’]’));

searchButton.click();


Additional Commands

Besides those basic commands, we should use some commands specifically designed for JMeter, so JMeter will be able to capture sampler’s start and end time. Those two methods will send JMeter the start and end signals for reporting purposes.

WDS.sampleResult.sampleStart();

WDS.sampleResult.sampleEnd();


Log Command

You might want to do some logging during your test. Then you just use the below command.

WDS.log.info(“Sample started”);


The rest is the same as running a JMeter script on the cloud. All the configuration like concurrent user count, ramp up periods are configured as a JMeter test. At the end of test execution, performance test results will be in the same format, also.

Testing

Published at DZone with permission of Canberk Akduygu. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • The Cypress Edge: Next-Level Testing Strategies for React Developers
  • Solid Testing Strategies for Salesforce Releases
  • Why We Still Struggle With Manual Test Execution in 2025
  • Why Testing is a Long-Term Investment for Software Engineers

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!