Currently Browsing

Posts Tagged ‘ code ’

Secure use of sendKeys() on pages created with Angular

We recently faced with an Selenium’s sendKeys() method issue which is related to the page which was made in Angular 1.5.8 (Most likely the same issue can be discovered in different versions). In most of the cases, the input field filled by sendKeys() method will contain just part of the desired text. Most often you will find just the first half of you desired text written into the input field. From our experience this bug appears only in the following circumstances:

  1. Page must be made with Angular
  2. The input field must be tagged with angular attributes, like ngModel, ngControl, etc.

Running webdriver code in JMeter

With the improvements in technology more and more of the business logic gets executed on the client side and it’s not easy to get a clear picture of the perceivable performance by using pure JMeter tests only.
To extend these measurements JMeter-Webdriver plugin in JMeter can be handy to run WebDriver tests using actual browsers and to get client side execution statistics.

In the following section I will demonstrate how to configure and run a simple WebDriver test in JMeter.

First you have to download the plugin from the JMeter plugin page http://jmeter-plugins.org/downloads/all/ and then copy the library files into JMeter installation folder.

From now on when you start up JMeter you should have the extra Config Element and Sampler components visible on the tool list and they are ready to use

Some thoughts about the infamous StaleElementReferenceException

With the widespread of JavaScript we more and more met with one of our favourite exception which is the StaleElementReferenceException.
It can be tricky because it does not have to appear on the test development machine. This issue can hide in the test code and appear in unexpected situations.

The exception happens when the dom changes and the system can’t be sure if the Webelement is still on the page.
Dom changes can be caused by page refresh, javascript effects, ajax responses and so on.