Follow

Webdriver Test

In order to create a Selenium based functional test, you can set up a Webdriver Sampler in JMeter and upload it to BlazeMeter or you can use BlazeMeter's Webdriver Test feature.  

How to Configure the Test

You need two things to create a Webdriver Test:

1. A Selenium script (Written according to the WDS Javascript syntax detailed in this wiki page).

2. A standard test configuration.

The Selenium Script

Notice that you are able to add Selenium scripts per label so you could get a more informative report, and see the results per test or per label\s.

If you need a kick start, you may cope and paste the below selenium script and generate a webdriver test in no time.

var pkg = JavaImporter(org.openqa.selenium); //WebDriver classes
var support_ui = JavaImporter(org.openqa.selenium.support.ui.WebDriverWait);//WebDriver classes
var wait = new support_ui.WebDriverWait(WDS.browser, 5000);

WDS.sampleResult.sampleStart();//captures sampler’s start time
WDS.sampleResult.getLatency();
WDS.log.info("Sample started");

WDS.browser.get('http://duckduckgo.com')//opens website specified in 'http://duckduckgo.com'
WDS.log.info("Sample ended - navigated to duckduckgo.com");

var searchField = WDS.browser.findElement(pkg.By.id('search_form_input_homepage'))//saves search field into searchField 
searchField.click()//clicks search field
searchField.sendKeys(['blazemeter'])//types word “blazemeter” in field
WDS.log.info("Searched for BlazeMeter");

var button = WDS.browser.findElement(pkg.By.id('search_button_homepage'))//Find Search button
button.click()//Click Search Button
WDS.log.info("Clicked on the search button");

var link = WDS.browser.findElement(pkg.By.cssSelector('#r1-0 > div > h2 > a.result__a > b'))//also saves selector as variable but uses CSS.
link.click()//Click the search result's Link

WDS.sampleResult.sampleEnd();

A friendly and prompt view of the selenium scripts per each label can be viewed by hovering over the 'Eye' icon as seen below.


The Standard Test Configuration

Here's a breakdown of each property:

  • Users: Select the number of users you want. The engines and thread are adjusted automatically according to this number.
  • Engines and Threads: If you dont want these to be set automatically, you can manually set them by unchecking the 'Users' section. Note: Free-tier users dont have access to engines and are limited to 50 threads.
  • Ramp Up: Select how fast you want the test to ramp up.
  • Iterations: Select the number of iterations in the test. Note: this is automatically set to infinitive
  • Duration: Set the full time duration that you want the test to run
  • Delay: Set the time delay between each page request.
  • Limit RPS: Set the number of requests per second you don't want to go over.

That's it! You're ready to run your Webdriver test!

 
Want to learn more? Read our blog post, 6 Easy Steps to Testing Your Chrome Extension With Selenium.
Have more questions? Submit a request

0 Comments

Article is closed for comments.