Micro Focus QTP (UFT) Forums
Dynamic Object Names - 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: Dynamic Object Names (/Thread-Dynamic-Object-Names)



Dynamic Object Names - Hawks1980 - 04-22-2009

Hi,
I have a page which contains WebRadioGroup objects. The Object name for each object is Dynamic though so everytime the page is loaded the object name will be different, which causes my scripts to fall over. How do I reference these dynamic objects?

Thanks
Tom.


RE: Dynamic Object Names - sangeethav - 04-25-2009

You can try this piece of code:
I had a similar problem and these steps resolved it.
Capture the WebTable in your Object repo.Then Use child Objects method and retrieve the dynamic value of the radio button.
In the last step , i have mentioned <#0> , meaning select first radio button.You can specify as you need .
set
Code:
WebRadioGroupname=Browser("Browsername").Page("Pagename").WebTable("Tablename").ChildItem(<RowCount><Column Count>,"WebRadioGroup",<Index>)
ab= WebRadioGroupname.GetRoProperty("name")
Browser("Browsername").Page("Pagename").WebRadioGroup("RadioGrpLogicalNameFromObjectRepo").SetTOProperty "name",ab
Browser("Browsername").Page("Pagename").WebRadioGroup("RadioGrpLogicalNameFromObjectRepo").Select "#0"