User Defined Objects and Element Recognition Logic
As we discussed earlier whenever you record actions or add an element to the element repository, it appears in the Element explorer. Test Studio internally generates a Find Expression that it then uses to locate the position of the element in the webpage.
But let’s assume we are working on a webpage whose elements possess dynamic attributes, in this case, one or more element property may change each time the page is loaded. So, the next time when this page will load Telerik Test Studio will not be able to find the element. By using Edit element we can change the recognition properties of an element to something which is recognizable by Test Studio.
Just right click on the element in the element explorer to view the options.
How to Edit Element Properties in Telerik Test Studio
Edit Element
Edit element allows you to edit the recognition properties of an element. Click on the Edit Element.
Find element screen will appear, offering you three options:
Find in the Live Version
Using this will take you to another screen,
- The new browser launches a new instance of the application, click on Browse & Navigate to open a new instance of the application and then Navigate to the element page manually.
- The current page offers a drop-down for selection of existing pages. You can select the page and click on Go > to navigate to the page.
- Existing Test Step allows you to choose a test Step from the application to get to the element. Selection Choose test step button will open another Pop-up with the list of Tests and Test Steps containing that element.
- Select a step and click on the select button.
- This will execute the particular test upto the selected step and if you navigate back to Test Studio, you will find “Find Element” screen. The selected part is properties that are used to identify this element. A user can edit the properties in the Find Setting frame for better recognition.
Edit in Live
You can also select Edit in Live from the right-click menu. This will directly open Find Element dialog if the recorder toolbar is open along with the page where this element is present.
Right Side of the Find Element dialog shows suggestions based on the element that you have selected. It also displays the object attributes that are defined for the project. Suggestion helps in finding an element in the application. Clicking on any suggestion will add it to the “Find Setting” frame and it will be used to recognize the element.
It also contains DOM structure, click on the DOM tab to view the DOM structure.
The Find Element also allows the user to define the type of relation between an attribute (like ID, Name, TagName, TagIndex etc.) and its value.
Let’s assume we have an element whose tagname value starts with “a”. So, Test studio offers different string-based expressions. The user can use this to make comparisons. So, if a tagname contains “a” then we can simply use “a” in the textbox and choose comparator as “contains”. This will mean that Test Studio will look for the elements with attribute tagname and value that contains “a”.
Similarly, the user can choose several different comparators based on the value of an attribute of the element they need to find.
The validate button at the bottom of the Find Element page allows users to make real-time validation, if the attributes and values of the attributes selected are able to find an element or not. If it is not able to recognize the element, it will show an error and will ask you to modify the settings to find the requisite element.