Can’t use a new property with a web object and QTP

  • Questions
  • Can't use a new property with a web object and QTP
Question ID: 105530
0
0

When a user wants to add a new property for UFT to track for a Web Element, such as "title" or "color" and goes through the following steps:

1. Tools -> Object Identification
2. Select the dropdown for Web
3. Select WebElement and then Add/Remove
4. Select New… and then enter the new property name
5. Spy on the object in the application that contains that property name
The property is included, but no value is recorded. This prevents the tester from being able to use these properties for uniquely identifying the object, and the developer has specifically set these properties for that purpose.

Marked as spam
Posted by (Questions: 175, Answers: 22)
Asked on July 28, 2014 1:46 pm
4 views
Answers (1)
2
Private answer

You mentioned you are working with Web objects. You might want to double-check the format for web objects. There is a KB article that talks about this, but I will summarize what you need to do. In particular, please look at the important notes section below that talks about the formatting. You will most likely need to use the attribute/property pattern to get this to work with a web object.

============================================================================

HP Knowledge document ID: KM194592

Solution

Add the desired Native/Run-time Object property to a description of an object of a certain class:

1. Verify that the test object shows values under the Run-time Object / Native properties section of the Object Spy.

2. Go to Tools -> Object Identification.

3. Select the appropriate environment in the Environment combobox (such as Web, .NET, Java, etc.)

4. Select the Test Object class from the list to edit.

5. To force QTP to always learn the property, click under the Mandatory Properties list. To make QTP learn the property when it is needed to uniquely identify the object, click under the Assistive Properties list.

6.In the Add/Remove Properties dialog, click .

7.Enter the name of the Run-time Object property (as it appeared in the Object Spy).

Important :

* Use lower case.

* For Web objects: use the ''attribute/'' format as the property name, for example, if you need to add a property named ''color'', you would need to specify ''attribute/color'' as the property name. The Web Add-in should now be able to get the property value from the html source code for the web object.

8. Click the OK button. You should now see the new property in the list of available properties.

9. Make sure the property is selected, and click OK again. This new property will now appear in the list of properties to be used to identify the object from now on.

10. Repeat steps 4 through 8 as needed.

11. Click OK to close the Object Identification window.

Now when you record, it should learn the new properties you've added above and QTP should be able to use those to uniquely identify the object(s).

Note: This solution is applicable and relevant for environments which have Native / Run-time Object properties and not for standard Windows classes.

Marked as spam
Posted by (Questions: 2, Answers: 425)
Answered on July 28, 2014 1:48 pm