Hi opensta1. A few questions, are you saying that the object's Name property is dynamically generated or is it the Label that the user sees on the web page? I'm not sure but it almost sounds like QTP is creating a new instance of the same object in your Object Repository and just appending the number you are talking about.
As a side question are you using the MI .Net Add-in for QTP?
We are using QTP v6.5 to test a .NET web-based application. For some lists on the webpage, the object ids are generated dynamically so it appends a no. (after the under-score) at the end of the object name.
The issue is that this no. changes between the time the scripts was recorded and re-played (unless we re-store the database to a same starting state). Does anybody has experienced a similar scneario? If yes, please share any thoughts/solutions.
The convention is to append a numeric value at the end of the object name. ASP.NET does it to make it unique so we are not controlling this from our internal application. To give an example, following are properties of an instance.
type - text
html tag - INPUT
html id - rlQual0_cat2_DayRate_5
and some other location and size parameters that are too common to be unique. Thanks.
Warning: I did this all with the IE DOM so I don't know how it would work with the dynamic coding or the Object Repository.
Take a look at the label associated with the control. Does it have the property .htmlFor?
I had to do a really convoluted thing where I would search all the labels for the text associated with the control I was trying to use. Then I would use the value in the .htmlFor property to get the ID of the control I'm trying to work with.
There is another situation in the same app where I had to take the ID for the label and then parse out the unique part. (Everything to the left of the underscore.) I then took that and combine it with the part of the INPUT control name that was consistant from run to run. This allowed me to identify the control I wanted to interact with.
It was a big pain but it dealt with the problem I had with identifying controls in a .NET web application.
If you're a slave to your free associations, does it automatically become something else?