How to run selenium script in Jmeter

  • 2 Replies
  • 1509 Views
How to run selenium script in Jmeter
« on: October 02, 2016, 19:12:06 pm »
I want to run selenium script in Jmeter. Is it possible or not ?

*

mark

  • *****
  • 2
  • Talk is cheap. Show me the code.
Re: How to run selenium script in Jmeter
« Reply #1 on: October 04, 2016, 14:28:59 pm »
1. Download Webdriver plugin https://jmeter-plugins.org/downloads/all/ and move to lib/ folder.
2. Add [email protected] - Firefox Driver Config and [email protected] - Web Driver Sampler to your test tree
3. 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()

4. Execute your test

Re: How to run selenium script in Jmeter
« Reply #2 on: October 04, 2016, 19:09:51 pm »
Hi Mark,

Thanks for your reply.  I am using java language for script development, so can i use same plugin for java language ?

Regards,
Poovaraj

 

Sitemap 1 2 3 4 5 6 7 8