Failure Troubleshooting Guide

If your test case execution fails for any reason, this requires investigation to find the root cause of the issue. Here are some common failure causes to help you through the process:

'Web element/Locator not found'

This is one of the most common issues that you may run into while running your tests. The error that will be displayed for this failure is below:

When using Web Locators:

When using Inline XPath:

Steps to Diagnose

To diagnose the issue, investigate as follows depending on the where execution is:

  1. For local runs, verify that the locator/inline XPath points to an element or not. You can copy the XPath or identifier (Web ID, Name, CSS Selector etc) and try to find it by right-clicking and inspecting on your web page to locate the element. 
  2. For cloud runs, check the failure image or watch the video to reach the point of the failure and understand what happened before the step failed. You may need to run the test locally for easier troubleshooting.

Causes and Solutions

  1. Element does not exist. In this case, you need to decide if this step should be optional, should be skipped or can be removed altogether. To change steps to optional ones, you can simply change the Runtime Options on those steps to Continue on Failure or Continue with Pass Status.
  2. The element exists, but the XPath/identifier points to a different element. In this case, all you have to do is to use a different XPath/identifier to locate the element and update the web locator or inline XPath in your step.
  3. Element exists and the XPath/identifier points to it. In this case, there are 2 potential causes:
    1. The element you are looking for may potentially be located inside a frame. In this scenario, you must define a frame XPath and use it in Switch_Frame command, or paste the XPath in Frame field under the Web Locator.
    2. The element takes time to load, so by the moment automation tries to find it, it is not yet loaded. In such scenarios, you could try increasing Locator Timeout under User Preferences to a higher value to give automation more time to find the element. By default, locator timeout is 5 seconds, which may not be enough depending on your application behavior/speed. Another alternative to Locator Timeout is to use Set_Timeouts command which operates at the step level rather than entire execution level.
  4. Element exists by searching with XPath/identifier, but it's not visible. In such cases, automation may not be able to interact with invisible elements. You can try switching to another XPath/identifier which points to a visible element instead. Another cause of the element not being visible is that your application keeps elements loaded in the background while the window in front shows different elements.
  5. Element exists but it's on a different window. In such cases, automation needs to know which window to look at in order to execute your steps. If clicking on an element on your application shows a new window, you will need to switch to it using Switch_Window command. Alternatively, you can use Popup field on Web Locators to add the text only visible on the window where your element is located.

-------------------------------------------------------------------------------------------------------------------------------

'Cannot open site timeout' 

This failure appears on Goto_URL command steps as a result of the website not loading quickly enough

 

Steps to Diagnose

  1. For local runs, check that the webpage is loading properly on your device
  2. For cloud runs, check the failure image or watch the video to see if the webpage is loading properly

 

Causes and Solutions

  1. Verify that the application is not currently experiencing any delay or technical issues. It could be that the application was slow for a period of time during execution. 
  2. If the application loads successfully but Subject7 still shows the error, it indicates that Subject7 did not receive a response that application loading is complete. This could be due to a technical issue with the application itself. A possible solution would be to increase Page Timeout under User Preferences to a higher value to give automation more time to load the page.

-------------------------------------------------------------------------------------------------------------------------------

'Timed out receiving message' 

This failure is mostly similar to the previous one but the main difference is that it appears on other commands which fail due to the page loading lower than expected and automation cannot interact with the element. You can follow the same solution above.

-------------------------------------------------------------------------------------------------------------------------------

'element click intercepted' 

This failure occurs when the element to be interacted with is found but is somehow being concealed by another element which would receive the click. The error that will be displayed for this failure is below which changes depending on the structure of the page:

mceclip3.png

 

Steps to Diagnose

  1. For local runs, refer to the step where the failure occurred to see what is concealing the element
  2. For cloud runs, check the failure image or watch the video to see what is concealing the element

 

Solution

Run the test case at the point where the element that conceals the required element is visible. You can define a locator or use Inline XPath for closing this element. If this element does not always appear, you can change the ‘Runtime Options’ for this step to ‘Continue on Failure’ or ‘Continue with Pass status’ in order for the test case not to fail if the element is not found.

-------------------------------------------------------------------------------------------------------------------------------

'element not interactable: element has zero size' 

This failure occurs when the element to be interacted with is potentially concealed by another element or may have zero widthheightfont-size or line-height.

 

Solutions

  1. Run the test case at the point where the element that conceals the required element is visible. You can define a locator or use Inline XPath for closing this element. If this element does not always appear, you can change the ‘Runtime Options’ for this step to ‘Continue on Failure’ or ‘Continue with Pass status’ in order for the test case not to fail if the element is not found.
  2. If the element is not concealed by another window, you can try using an XPath which points to another element in the same region which may work and the error is no longer shown.

-------------------------------------------------------------------------------------------------------------------------------

'stale element reference' 

This failure occurs as a result the test case finding an element but before interacting with this element, something changes in the DOM, so the element is no longer the same or no longer found on the page.  In other cases, this failure could also occur when the web driver version is older than the most recent version of the browser but still compatible enough to execute the test case. The error that will be displayed for this failure is below:

mceclip4.png

 

Steps to Diagnose

  1. For local runs, refer to the step where the failure occurred and try to do the same action manually
  2. For cloud runs, check the failure image or watch the video to see how the website behaves when the step is executed

 

Solution

  1. Run the test case locally to see how the test case behaves. In most scenarios, this error occurs when the test case tries to interact with an element but a window, for example, appears in front of the element so the DOM changes slightly and hence the error is thrown. A solution would be to add a Wait step before the test tries to interact with the element, giving it more time, and other steps added to remove the window from front. This will ensure the test case finds the element and interacts with it uninterrupted by any change in the DOM.
  2. Wait for the the platform to be updated with the most recent version of the web driver and execute the test case to see if it passes.

-------------------------------------------------------------------------------------------------------------------------------

'Frame with locator - not found'

This error occurs when a frame cannot be found with the provided XPath.

Causes and Solutions

  1. Run the test case locally to see how the reach the point of the failure, then copy the frame of the XPath and try to find it in Inspect screen on your app.
  2. If the XPath does not match with an element, then you will need to provide an XPath that points to the correct frame.
  3. If the XPath finds an element, you will need to review the order of your steps. It's possible that your test switched to a frame earlier and your current step is looking for a frame inside a frame which does not find it. In this case, you can use a Switch_Frame step which goes back to Main then switch to the frame XPath desired.  

-------------------------------------------------------------------------------------------------------------------------------

'Cannot open site invalid argument'

This error occurs when you are trying to navigate to a website with a URL in an invalid format.

Solutions

  • Double check that the URL in your Goto_URL step is in the correct format. If you are using data template injection, it's possible that one character was removed in error. In other scenarios, it's likely that you entered "www.site.com" rather than "https://site.com"

-------------------------------------------------------------------------------------------------------------------------------

'More than one element was found'

This warning occurs when the XPath/ID/Selector matches more than one element on the page. This does not cause the test case to fail, instead the first element is interacted with and the test case is marked as fail_skip. The warning that will be displayed is below:

mceclip5.png

 

Steps to Diagnose

Run the test case locally to reach the point where this warning appears, add a breakpoint just to ensure that the next step does not start. Use the XPath/ID/Selector to find all matches and understand what the other elements refer to.

 

Solution

  1. Redefine the XPath/ID/Selector to be more unique to the element so that it only brings up this element. You can use other tags or attributes or use indexes as a last resort.
  2. Finally, use the new XPath/ID/Selector in your locator definition.

-------------------------------------------------------------------------------------------------------------------------------

'Global variable "variable_name" is not defined'

This error occurs you are trying to get the value of a global variable name that was not defined. It could mean two things:

A. The global variable name in Get_Global_Var step is correct, but the test case which defines the global variable using Set_Global_Var command was never executed

B. The global variable name in Get_Global_Var step is incorrect

 

Solution

  1. On the test case that defines the global variable using Set_Global_Var, make sure that this test was executed so that the variable is saved.
  2. Make sure that your global variable name in Get_Global_Var matches what was entered in Set_Global_Var

-------------------------------------------------------------------------------------------------------------------------------

'Supporting element was not found'

This is the most common error when executing desktop commands and appears when the test case tries to find the element but fails to do so.

 

Solution

  1. If you are using desktop locators, take another screenshot of the element and upload it to the same file that the desktop locator is using. 
  2. If the failure is happening on cloud execution, download the screenshot of the failure and crop it to the element, then upload it to the file that the desktop locator is using.
  3. If you are using either desktop locators or Use Text option (OCR), you can also use Enable Crop Target Region option which allows you to narrow down the search area in which automation will try to find your element in. For example, if your element always appears on the top left side, you can use 80% in the bottom, and 80% in the right side. This way, automation will only be looking at the 20% area on the top left side.
Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

Comments

Please sign in to leave a comment.