Micro Focus QTP (UFT) Forums
Which properties to use to access or identify (runtime) objects using script ??? - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Which properties to use to access or identify (runtime) objects using script ??? (/Thread-Which-properties-to-use-to-access-or-identify-runtime-objects-using-script)



Which properties to use to access or identify (runtime) objects using script ??? - sepgs2004 - 03-05-2009

In one of my actions, I would like to access links from the run time page whose title is equal to a constant. I do not have defined this link as a object/resource in any local or shared object repository. The reasons are: the names, hrefs etc values of this link object are dynamically filled and it varies from run to run. So I thought to add a common title to these links and access them with the script this way (this is the action script in Expert View):

Code:
identOne = "title:=LinksOfCertainType"
counter = 0
indexId = "index:=" + CStr(counter)
While Browser("MyLicense Office").Page("MyLicense Office").Frame("mainFrame").Link(identOne,indexId).Exist(0)
Browser("MyLicense Office").Page("MyLicense Office").Frame("mainFrame").Link(identOne,  indexId).Click
'other processes..etc
counter = counter + 1
indexId = "index:=" + CStr(counter)
Wend

Runtime, if I spy this link object, I see the title value "LinksOfCertainType". Q1: I do not know why my code fails at the exist call.

So I am doubting Q2: if we can just use only the title property, in the script, to identify/access a runtime object. Then I cannot use the other properties easily.

Other thing is, these links are columns of a table... So I thought of to identify the table first, then go row by row, and corr. column, to pick up these links. Q3: How can we identify a table at runtime. When we say ....WebTable("something")... what is this something, is it the table name or... what property is it?


RE: Which properties to use to access or identify (runtime) objects using script ??? - sepgs2004 - 03-06-2009

I guess, for Link or WebTable objects (that are not in local or shared Repository), in which case direct script is used to identify, we cannot use Title attribute/property to identify. If we see in HP QuickTest Professional Object Model Reference -> Web (environment) -> Link ->Click on Link identification properties-> we do not see title property listed among the others.
However the Note in the same help document-page says as below:
Quote:You can also view a list and descriptions of the Link identification properties, for use in object repository descriptions, programmatic descriptions, checkpoint and output value steps, and as argument values for the GetTOProperty and GetROProperty methods.

But, When I go into QTP->Tools->Object Identification->(select) Web->Link-> I see title as one of the properties that can be used to identify...Why would they give title as a choice for an identification property if the other Note in Object Model Reference Help says differently.

Kind of confused. Please correct me if I am wrong. Probably I might be missing some basic concept here.

Also, I try to grab a collection of link objects using script, I get their getROProperty "title",
Code:
Set linkDescription = Description.Create()
linkDescription("html tag").value="A"
Set links = Browser("Browser").Page("Page").Frame("Frame").ChildObjects(linkDescription)
links(iter).getROProperty("title")
I do not see anything even though the title in the HTML source has value in it. Using Object Spy, I am able to see the value for the title. I do not understand this difference of behavior between the Object spy and the script.