Micro Focus QTP (UFT) Forums
Testobject at Runtime - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Testobject at Runtime (/Thread-Testobject-at-Runtime)



Testobject at Runtime - Giama - 03-24-2009

Can anyone give me an advice on how to create a Testobject at runtime?

I'd like to create a "Link" Testobject wich is not situated in the object repository. I want to generate it at runtime using the description stored in the excel sheet.

Tanks and cheers,
Giama


RE: Testobject at Runtime - Tarik Sheth - 03-24-2009

Hi,
I think you can try this.

Initialize the excel object DOM and pass the link name as the parameter to the action.

Code:
Set excel = createobject("excel.application")
    excel.visible=false
    Set obook=excel.workbooks.open("C:\test.xls")
    Set osheet = obook.worksheets(1)
             LinkName=osheet.cells (2,13).value
              
Set oDesc = Description.Create()
oDesc("name").Value = "{Link Name}"
Browser("Browser").Page("Page").Link(oDesc).Click