While automating a page, there should be some mechanism to locate the Web Elements with which the test interacts. Testsigma uses it's UI Identifiers to locate these Web Elements. UI Identifier of a Web Element for example, a button can be the value of its attributes. The common attributes for HTML Elements are id, title, name, type, placeholder, class, text e.t.c


When locating a Web Element using any of these attributes, we need to make sure that the value is unique. For example, if there are two buttons with the name 'submit' on the same page, we cannot use that attribute. In short, we need to get properties of an Element that is unique to it for usage as a UI Identifier. In cases where no other unique Identifiers are present, we will make use of Xpath locators or CSS locators.


However, there can be a number of issues when using UI Identifiers for your Test Steps. Some of them are:

  • Problem 1 - Duplicate UI Identifiers
  • Problem 2 - Hidden or disabled Elements
  • Problem 3 - Incorrect/Invalid UI Identifiers
  • Problem 4 - Empty UI Identifiers
  • Problem 5 - Element not clickable


Problem 1 - Duplicate UI Identifiers

In this case, the Test Step might not actually fail. The Test Step will pass and the execution will continue although the correct Element was not selected. This is undesirable.



As you can see above, we used the xpath //input[@type='password'] and there are two matching Elements as shown in the image for the same xpath. This is a case of duplicate UI Identifiers and even if we need to select the second field, the first Element with the corresponding UI Identifiers will be selected always.


Solution - Use a different XPath that is unique for the element.


Problem 2 - Hidden or disabled Elements



Solution

Element is either hidden or disabled exception If you found this error in your test step failure message, check whether;

  • the given UI Identifier locates an Element that is actually present in the Web page. Sometimes, the element might be created dynamically and might not be present in the Web page during the Test Execution. In such cases, wait for the element to be present by adding a wait step.
  • the given UI Identifier is hidden or disabled. Elements are sometimes hidden or disabled by the developer if they are not meant to be interacted with.



You can see the type='hidden' for this element. An element may be hidden also using class names such as 'hide', 'hidden' or directives such as 'ng-hide'




Problem 3 - Incorrect/Invalid UI Identifiers


Solution

The element corresponding to the locator type "id_value" and locator "//*[@id='lgnjs']" is not displayed:

If you found a similar error in your test step failure message, check the selected locator type corresponds to locator value.

In the above message, locator type is 'id' but the given locator value is in 'xpath' format. Correct it and try again.


The element corresponding to the locator type "xpath" and locator "//button[@type='value']" is not displayed:

We can rule out the mismatch of Locator Type and Locator value in the above message.

If you found this error message in your test step failure message, check the UI Identifier manually to confirm that

  • the element is actually displayed in the present page.
  • the element is not contained in an Iframe or other external Frames. If yes, please add a Step to switch to that frame.
  • the UI Identifier value is correct or not.




Problem 4 - Empty UI Identifiers


The element corresponding to the locator type "id_value" and locator "" is not displayed:



Solution

If you found this error message in your test step failure message, check the value of the UI Identifier and make sure that ui identifier value is not be empty.





Problem 5 - Element not clickable

Element not clickable at point (x,y). Other element would receive the click:



Solution

If you face the above error, check whether;

  • the Element is inside your view port. If the Element is not inside the view, add a Test Step to scroll to the Element.
  • the Element is overlapped by any other Element(like sticky menus, drop down menus or alerts). If the Element is covered or overlapped by another element temporarily, add a wait step for the overlapping element to be removed or add a Step to remove the overlapping Element.