Integrating Selenium with Newtest: why and how

October 02 2018 By Posted in Product News
Selenium is a collection of drivers which can steer a wide range of browsers like Firefox, Chrome, Safari, Internet Explorer, and Edge, in addition to emulators. It’s all the rage with developers for non-regression testing of the user interface.

Selenium is driven by a programming language (Java, Python, PHP…) which then provides for running commands on web browsers. The driver is directly integrated into the script in Java, Perl, C++, Ruby, or other languages, and the calls to Selenium functions are made entirely within the scripting language.


Newtest & Selenium

One reason to integrate Selenium with Newtest is to automate the administrative task of updating of user experience monitoring in production.
To do this, Newtest runs the Java script, for instance, and retrieves the ensuing results and response times to propagate to NMC (Newtest Management Console). Next, the results of the execution are integrated in the standard way, with Newtest alerting.


An advantage of implementing Selenium with Newtest is that scripts from R&D can be reused, consequently saving time on scripting. Another major advantage is that it pushes automation up a notch, in particular between R&D and Operations.


Selenium vs NewtRIA

NewtRIA is the Newtest solution for controlling web applications. We compare these two functionalities in the table below:


To sum up, Selenium is supported by a wide range of browsers, notably those which are not covered by NewtRIA, like Safari and Edge. Selenium also has a considerable variety of DOM navigation functions, including selectors (you can select an element in a variety of ways, by class, by ID, etc.). With NewtRIA, essential monitoring actions can be performed, such as identifying an element, clicking on it, and searching text for integrity checks. Both can inject JavaScript, which is often useful as a shortcut, particularly via jQuery. As for clicking on an image, which can come in handy for SPAs (Angular, React, etc.), only NewtRIA offers this ability.
Unlike NewtRIA, which is intended for production operators, Selenium is designed for web developers.


How to add Selenium to Newtest

First of all, you need to set up the Selenium development environment and libraries on the Newtest robot. Next, add the Selenium scripts in the programming language to the Newtest robot, with a specified path (configured as an .ini parameter in order to be configurable in a deployment tool). Afterwards, ProgramExec can be used to run the Java/Python scripts in a command interface, for instance.
Then, to retrieve response times, two techniques are available:
1. Measurements can be conducted in Selenium using system timings and then be retrieved to Newtest using LogTpsFromArg, which reads variables in a console and propagates them as measurements to Newtest.
2. Or you can conduct measurements with the timers in Newtest, and use the standard outputs provided for in the script.


Find the full webinar on the subject by clicking here.

Leave a Reply

Your email address will not be published