...
Anchor | ||||
---|---|---|---|---|
|
The Object Spy has the following locator types:
- Name
- Id
- Link
- Xpath
The sequence of these Locator Types can be changed to your best fitone that best fits your needs.
Locator Priority Settings
The built-in algorithm helps to choose best suitable Locator Type while finding the best Locator suitable to HTML element being inspected.
To change the locator priorities:
- On Object Spy toolbar, click the Settings icon.
The Locator Priority Settings window appears. - Click Up/Down buttons to changes the priorities of the Locator Type.
- Click Restore Default to restore the default priorities.
- Click Cancel to discard changes.
- Click Ok to apply the changes.
...
Based on the preferred locator types, Object Spy looks for name property of the desired object. If it is not found it looks for the next preferred locator type which is for example id. If it is not found, it then derives Xpath by referring to other native properties of the object or even of a parent if required. This is typically required in a case of duplicate objects.
For more information on duplicate objects refer to the following section:
Challenging Situations in Object Identification and Remedies.
A case when Object Spy overrides the preferred locator type even if the object has Name or Id attributes
Assume you have set preference of Locator Type as Name, Id, Xpath, and Link. The object which you want to add has name property. Object Spy reads the value of name property and check checks whether there is another object that has same value of the name property. If a duplicate is found then Object Spy overrides preference and look looks for id or Xpath.
Once Object Spy is sure about the locator type and value being unique for the object, the object will get added. You can further edit the logical name of the object and rename it.
Once the objects are added and saved from Object Spy, you can select objects from the object drop-down without any need to refresh or relaunch Qualitia.
Anchor | ||||
---|---|---|---|---|
|
Anchor | ||||
---|---|---|---|---|
|
This is very much peculiar to Selenium the way it a typical method that Selenium operates with objects. Selenium searches the object within the scope of the HTML page. Frame element also can hold 'HTML' tag enclosed within. If Selenium is supposed to act on any object under frame, it has to first decide the scope of searching the object in the HTML within the frame and not outside HTML. This is typically done by selecting a frame during development of a test case.
...
Object identification failure can be categorized in by the following cases:
- Object does not exist
...
A tool may fail to identify an object when object identification is based on incorrect attributes. Selected attributes might not have a static value. At times, there are properties, which are supposed to be static but contain dynamic values.
For example, id attribute is supposed to be static but there are frameworks that generate values of id attribute dynamically.
In such cases, your id values are supposed to change every time you refresh a page. On the other hand, there can be situation where a window is identified by title. If title contains timestamp time stamp as a part of the title, it is prone to change repeatedly after each login. In all such cases, it is advisable to look for other another property that is static and uniquely points to the desired object. If there is none and you have to deal with dynamism of the attribute value, check whether the dynamic portion of attribute value is predictable or not.
For example, when user1 logs in, the Login window has a title 'welcome user1'. If you change the login credential to user2, welcome will remain the same and the dynamic portion 'user2' is predictable that is 'welcome user2'.
Dynamic portion in this case is the same as the user credential used. Same The same user credential can be passed as part of attribute value.
For more information on how to handle this situation in Qualitia, please refer to "Qualitia Object Spy Feature Help".
If dynamic portion is not predictable, then the common practice is using regular expression to get rid of the dynamic portion. In the same example of login title, title property can hold a regular expression as 'welcome.*'. You can ignore the dynamic portion and rely on static portion if it uniquely points to the desired object.