By Kaloyan, QA Lead at Flat Rock
When you think about what to automate, the first thing which appears in one’s mind probably will be the way in which the QA tests the system by clicking on every button and filling all fields with different types of information.
One of the best tools to do that is Selenium. It’s a free UI tool which interacts with the system in the same way like the QA specialist. You can use one of the three types of the tool which are developed till now:
1. Selenium IDE - it’s a Firefox plugin and provides an easy-to-use interface for developing automated tests. The main advantage of the IDE is that it can record the user actions and then these actions/cases could be exported into a reusable script in one of many programming languages. The main disadvantage is that it cannot be used alone as the risk of wrong results is high.
Now let’s dig deeper in what the WebDriver is. It’s a library with different methods, which are basically used for interacting with the html elements displayed on the page. The most used methods are for finding specific elements in the html, for example buttons, text fields, check boxes, etc. The WebDriver uses locators for finding them:
→ By ID – it’s the best way to find an element on the page, because the ID is unique and the driver will not be confused. It would be good to avoid auto-generating IDs.
→ By class – this refers to the attribute on the DOM element. Often there are many DOM elements with the same class and in this situation it will be hard to find a specific one.
→ By tag name – the DOM tag element on the page. Again – there will be many elements with the same tag on the page.
→ By name – find the input element with matching its name attribute.
→ By link text – find a specific hyperlink on the page by matching its visible text.
→ By partial link text – find a specific hyperlink with partial matching its visible text.
→ By CSS selector – it’s a locator strategy by CSS. Native browser support is used by default but some CSS locator which might work in one browser but may not work in another.
→ By XPath – WebDriver uses a browser’s native XPath. On those that don’t have native support, Selenium HQ have provided their own implementation.
In some cases, it’s not easy to find a specific element on the page. As it was mentioned before, Selenium is working like an end-user and can interact only with elements which are visible on the page at the moment. In case that something cannot be find with these locators, the QA specialist should use a different approach.
Selenium 2.0 WebDriver has multiple browser support. The only limitation is when a new version of the browser is released. Then it will take time for the new version of the WebDriver to be developed.
It’s possible to integrate Selenium with JIRA, Jenkins or other servers and tools which the development team is using in the project.
Selenium 2.0 WebDriver is a good way to automate one big part of the QA process. It’s also suitable for mobile applications with its Appium library. Earlier this year Selenium HQ announced their new tool – Selenium 3.0 WebDriver with an improved functionality.
Flat Rock is specialized in development and testing of bespoke software both manually and automated. Contact us to learn how to optimize your product or in case you need a hand in verifying software quality.
