Getting the error as "Found ‘x’ elements . Use “index” variable to select single element."
When one xpath has more than one element or element count is greater than 1 , then we need to provide index parameter to point to the exact element. Above error is displayed if the elements are more than one for a single xpath.
Following are the steps to add index in the UIcontrol page.
- Go to the UIControl page from the design screen and open the element for which above mentioned error thrown. Click on the PROPERTIES button as shown below.
- Add ‘Index’ as property in the Property name field and click on ADD button as shown.
- After adding, Click on the ELEMENT button which open the Overview page . Scroll down and change the datatype of ‘Index’ property to number and enter the exact index of the element in the text box below. In this example, index is 1 as first element is what we trying to click. Similarly , exact index can be entered if the element looking for is different.
- Save the page and run the task again to verify.