Using Selenium to automate browser testing

At Arrk Group we use a variety of tools to assist the team when testing web-based applications. One such tool, or more specifically a suite of tools, is Selenium. We aren’t alone in using it either, thanks to it being open source and incredibly useful it is one of the most popular tools for automating testing of web-based applications available.

One of key reasons for its popularity is its flexibility, being able to support multiple web browsers, including Internet Explorer, Chrome, Opera, Safari and Mozilla Firefox. Not only that but it can be used on Macintosh and Linux, as well as mobile testing on iPhone, iPad, Android and Blackberry.

The four sides to Selenium

Selenium consists of four elements; let’s take a look at each element individually:

Selenium IDE (integrated development environment) is a Firefox add-on which includes a recording mechanism. One of the primarily benefits of using IDE is that no programming experience is required to run it. It allows executing a test case at a time or the entire suite of test cases. Test data can also be exported and used in Selenium RC and WebDriver. However, it does not support iteration, conditional operations and exception handling.

Selenium Remote Control (RC) provides the ability to write automated web application tests in any common programming language, such as Java, C#, PHP, Perl, Python or Ruby against any HTTP website, using any mainstream JavaScript-enabled browser. It is best used for creating logic-based testing such as conditional statements, iterations, exception handling, test reporting, database testing, capturing screen shots of failed tests, test case grouping.

Selenium WebDriver, sometimes known as Selenium 2, has been developed to offer improved support of dynamic web pages where elements of a page may change without the page itself being reloaded. WebDriver’s goal is to supply a well-designed and a comprehensive object-oriented API that provides improved support for modern advanced web-app testing problems.

Webdriver supports headless browsers, such as HtmlUnitDriver, to speed up test executions. Alternatively Webdriver can be used for scripts which need to be run on console (non-UI) based operating systems, such as Linux, or if scripts are integrated to a Continuous Integration System which relies on a console (non-UI) environment.

A great add-on for Selenium is Grid which is ideal for creating and running a distributed test execution environment, it allows for different machines and different browsers to run tests in parallel. This parallel testing speeds up testing time and ensures faster responses and improved decision making.

Why use Selenium?

Arrk Group uses the Selenium tool set for a variety of reasons, not least because it has a mature API which means we can test a broad spectrum of functionality – from button clicks and form field actions to cookie controls and AJAX-based UI elements.

Its flexibility in having the ability of executing tests in parallel on different machines and browsers also saves a considerable amount of time.

Another big advantage of Selenium is that it is entirely open source, and is able to be integrated with just about anything to provide a robust test framework, such as Maven or Ant for automating builds, TestNG to drive tests, Jenkins or Hudson or Cruise Control for continuous integration. It also enjoys a highly active community, which ensures that there is plenty of guidance and advice available.

Highly flexible and extensible, Selenium also has the support of some of the largest browser vendors, which are taking steps to incorporate it as a native part of their browser. It can also be found as core tech within other automation tools, APIs and frameworks.

Limitations of Selenium

However, Selenium does come with some limitations which need to be considered, first and foremost image based testing is not straightforward compared to some other commercial tools on the market, while the fact it is open source also means that there is no guaranteed timely support of the product.

To get the most from the suite it also requires some dedicated skilled human resource capable of programming in one or more of the supported languages to automate the application successfully.

Another limitation of Selenium is that it only supports web-based applications, therefore non-browser based application support is not possible to automate.

Conclusion

Selenium provides lots of value at a minimum cost for automating web applications and for the technically inclined it provides power and flexibility to extend its capability many times over making it a very credible alternative to other test automation tools on the market.

Authors

Interested? Get in touch

Name:

Telephone:

Email:

Message:

Digital Maturity Assessment

Complete our five minute survey and you will be sent a detailed report on how you compare to your peers across five dimensions. The report will also contain best practices in each of these dimensions to guide your digital transformation.

We have a profound commitment to collaboration, executing engagements ranging from high value consultancy to whole-of-life ownership of complex digital platforms and infrastructures across a broad spectrum of industry sectors, from start-ups to multi-national enterprises.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.