0 votes
1 view
in Devops and Agile by (19.8k 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 (63.4k points)

There is an easier way to run Selenium scripts.

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

  2. Add [email protected] - Firefox Driver Config and [email protected] - Web Driver Sampler to your test tree

Jmeter test tree

  • Add this code

var pkg = JavaImporter(org.openqa.selenium) var support_ui = JavaImporter(org.openqa.selenium.support.ui.WebDriverWait) var wait = new support_ui.WebDriverWait(WDS.browser, 5000) WDS.sampleResult.sampleStart() WDS.log.info("Opening page..."); WDS.browser.get('http://duckduckgo.com') var searchField = WDS.browser.findElement(pkg.By.id('search_form_input_homepage')) searchField.click() WDS.log.info("Clicked search field") searchField.sendKeys(['blazemeter']) WDS.log.info("Inserted blazemeter keyword") var button = WDS.browser.findElement(pkg.By.id('search_button_homepage')) button.click() WDS.log.info("Clicked search button"); var link = WDS.browser.findElement(pkg.By.ByCssSelector('#r1-0 > div.links_main > h2 > a.large > b')) link.click() WDS.log.info("Clicked blazemeter link"); WDS.log.info(WDS.name + ' 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.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !