Please follow this post on how you can access Selenium Java Training projects and Selenium Tests Framework, step by step selenium test reporting framework!

Friday, January 30, 2015

JMeter and ajax request - 6th JMeter training video

This is 6th JMeter Training video tutorial in the series of learning performance testing.
This JMeter training session covers -

1 Adding user defined variable in Test Plan, ex: App URL
2. Ajax request Example - zalando-UK site
3. Replay the ajaxified JMeter script and analyze failure
4. Analyze the ajax request again with firebug and observe headers
5. Observe -
xsrfToken in Response Data for first request
X-XSRF-Token passed in header manager of ajax request
6. Introducing Regular expression extractor - Post Processor Element
7. Rerun the modified script

JMeter training video tutorial can be watched online. 


Sunday, January 18, 2015

HTTP Sampler - 5th JMeter training video

This is 5th JMeter training video in the series of learning JMeter.
This session covers -


1. jmeter.log file
2. Functional testing setting in test plan
3. JMeter HTTP Sampler
4. HTTP Default Config element
5. Response assertion

JMeter training video can be watched online

Wednesday, January 14, 2015

Return only first or last element from webelements collection

We often come across situation when there are multiple elements on a page and we probably like to exercise only a few of them using selenium webdriver. May be just first and last element. For example on a search result page we may like to click on only first and last link and not all. This is when Iterables API comes handy. (By the way I am assuming that you have already completed watching selenium training videos :)). Once we have collection of web element then we can use Iterables to get only first or last element as following -

Consider that we fetch collection of element as -

List<WebElement> webElements = getDriver().findElements(By.id("htmlID"));
 
Now we can get the first web element from this collection as - 

WebElement firstElement = Iterables.getFirst(webElements, 
getDriver().findElement(By.id("defaultElement")));
 
Herein second argument -
 
(getDriver().findElement(By.id("defaultElement"))) 
 
in the method getFirst is the default element which would be used 
when collection is empty. Once we have control of "firstElement" 
WebElement then we can click on it or use various other WebDriver
methods 
 
And we can get the last element from collection as - 
 
WebElement lastElement = Iterables.getLast(webElements, 
getDriver().findElement(By.id("defaultElement")));
 
Here again, second argument of method getLast is default element
 
So next time you want to exercise only first and last element from
a collection of web element then you can use these handy APIs and not
any weird loop. Stay tuned for more test automation tips :)

ShareThis