LEAPWORK Web Best Practices

Implementing any automation tool in the organizations would require the team to overcome some challenges smartly. Often the handy guidelines and best practices will play a major role in success factor. Please find below some of the best practices gathered by our team while exploring the POCs through LEAPWORK automation tool

Capturing Web Elements

LEAPWORK allow the user to capture web elements to interact with a web page while capturing element LEAPWORK generates multiple strategies for the same element and by default, it picks a best-suited strategy for the user.
In some cases it’s been observed that selected strategy works only first time and stops working after some time, there might be multiple reasons behind that for example, LEAPWORK picked Id based strategy and that Id is dynamic in nature (i.e. Id change after release/deployment) or the control is dynamic and changing CSS. To handle these challenges user can either pick another type if strategy from strategy editor or the user can write his own strategy.
The user can use “Strategy Editor” for creating unique and reliable strategies, by choosing strategies with Unique ID, CSS, XPATH, Custom Attribute, and Text and if none of above work the use multiple DOM elements in a parent-child relationship like (div > a > span)

For more info about Strategy editor usage please go thru below links

Handling Timing Issues

Defining Synchronization and Timeouts are the most challenging task in web automation, Synchronization and Timeouts governs stability of your test case.

LEAPWORK has an inbuilt feature to handle synchronization and timeouts challenges in any type of web test, below fields on block level help in achieving correct synchronization and setting correct timeouts

  • Timeout in (sec): The maximum time spent searching for the web element before giving up and triggering “Not found”, it’s a basically implicit timeout.
  • Await DOM Change: The number of seconds the DOM must have had no changes before proceeding.
  • Await request: Delay the search for the web element until there have been no active XHR requests for a specific period – for instance, 3 seconds.

Avoid using ‘Wait’ Block

The wait will force test to stop for a specific time, wait usually show the test and increase the time of execution so it’s advisable to avoid using Wait in test automation using Await instead.

Avoid using Positions

Avoid using static positions while using click position method as it will fail for different resolution and browser, instead use relative position or get the position of control dynamically and then use it in click element.

Handling Errors

Here are the three most common errors and their resolutions:

  • Web element was found but not clickable: There can be various reason for this issue, the first one is usually Timing issue where the user has to apply proper waits so that application is loaded to receive the click, try using Awaits to handle this issue. The other reason could be that there is another component on top of the control which receives the click instead of the actual one, please check this article for more information
  • No browser window detected: This message is shown when LEAPWORK is not able to find the browser window with given criteria in User Browser window building block, try using other search criteria to fix it.
  • Could not open Chrome, Please check that it is properly installed on your computer: This error message is shown when LEAPWORK can’t find Chrome.exe file in its default location, usually the default location in 64-bit Windows operating system is “C:\Program Files (x86)\Google\Chrome\Application\chrome.exe” and in 32-bit Windows operating system it is “C:\Program Files\Google\Chrome\Application\chrome.exe”. This issue usually occurs when Chrome is installed for only one/specific user, not for all users (as a result Chrome.exe file copied to Local user folder path instead of the standard path), this can be fixed using Chrome profile for the particular user or by installing Chrome for all users.

Re-Usability & Maintainability

The user can create highly reusable and maintainable cases by using the below techniques.

  • Re-usability: Create Sub-flows for repeating actions for example Login, Accept Cookies etc., this will reduce test creation time and increase productivity.
  • Maintainability: Working will Sub-flows helps in maintenance, lets take an example: assume after creation of script your control is updated in the application under test, now if you have that control in single Sub-flow block then you will update it there and it will automatically get reflected in all other cases where the Sub-flow is used. It will reduce maintenance and allow you to make your test maintainable and scale-able. On the other hand, if the control was not in sub-flow and was used in multiple flows individually then the user has to update it one by one in each place thereby increasing maintenance time, assume if the same control is used in 100 places then it needs 100 updates if the sub-flow approach is not used.

Working with Internet Explorer

LEAPWORK supports running test on IE11 or greater, running a test on IE11 is a challenging job, be aware that there will be a different type of challenge due to protected mode settings, compatibility setting and DOM structure of HTML in internet explorer. First step towards IE automation to “Enable our test environment for IE testing”, the following article will help you in setting up IE for automation. In case you still face the challenge and not able to proceed at all then try using Desktop UI technology for automation applications in IE.

Handling Scroll

LEAPWORK enable the user to scroll down with ‘Scroll to find’ and ‘Scroll into View’ option in Click and Find web element blocks.

Internal Developer support

In legacy or dynamic applications where it’s difficult to find locators (may be due to frequent CSS changes or run-time/dynamic Id’s) its recommended to ask development team to add some testing tags on controls of your application, this help in robust script creating and reduce chance of test failures due to inconsistent strategy.

Testing on Remote Environments

Using LEAPWORK user can scale testing without getting disturbed by using LEAPWORK Environment setup, LEAPWORK provides below mentions environmental setups

  • LEAPWORK Agent: LEAPWORK Agent capable to running Web, Desktop and Virtual test
  • Selenium Grid: User can setup his own selenium Grid and perform Web testing
  • Sauce lab/Browser Stack: LEAPWORK can directly be hooked with cloud-based testing providers like Sauce lab/Browser Stack to scale and run the test.

Need more of these best practices in LEAPWORK? Get in touch with us and our team will guide you to build the platform from E-2-E Automation journey.

Leave a Reply

Your email address will not be published. Required fields are marked *