Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.7k points)

I have Selenium automation scripts ready with the functional flow, now I want to integrate those scripts with JMeter for load-testing.
Is this possible?
If so how to integrate both?

My first aim is to run the automation script using selenium than run those scripts in JMeter for load or performance testing.

1 Answer

0 votes
by (62.9k points)

There is an easier way to run Selenium scripts.

  1. Download WebDriver plugin and move to lib/ folder.

  2. Add jp@gc - Firefox Driver Config and jp@gc - Web Driver Sampler to your test tree

Jmeter test tree

  • Add this code

var pkg = JavaImporter(org.openqa.selenium) var support_ui = JavaImporter( var wait = new support_ui.WebDriverWait(WDS.browser, 5000) WDS.sampleResult.sampleStart()"Opening page..."); WDS.browser.get('') var searchField = WDS.browser.findElement('search_form_input_homepage'))"Clicked search field") searchField.sendKeys(['blazemeter'])"Inserted blazemeter keyword") var button = WDS.browser.findElement('search_button_homepage'))"Clicked search button"); var link = WDS.browser.findElement(pkg.By.ByCssSelector('#r1-0 > div.links_main > h2 > a.large > b'))"Clicked blazemeter link"); + ' finishing...'); WDS.sampleResult.sampleEnd()

  • Run your test

For more detailed information about code syntax and best practices you can try Using Selenium with JMeter's WebDriver Sampler article.

Browse Categories