Interview Questions   Tutorials   Discussions   Programs   Videos   

QTP - How to handle dynamic objects in QTP?




306
views
asked marvit August 20, 2014 12:36 AM  

How to handle dynamic objects in QTP?


           

1 Answers



 
answered By Dharma   0  
How do I define/create a dynamic object?

    First Method:(method is explained inline)


Set newObject = Description.Create
'The above line declares a new object

newObject("micclass").Value = "WebElement"
'The above line sets the type of object (Browser/Page/WebElement/Link etc), in this case it is a Web Element

'The below 3 lines set the Dynamic/Runtime properties of the object

newObject("html tag").Value = "SPAN"
newObject("class").Value = "radio-classic-ITEM-OFF"
newObject("text").Value = Parameter("Text")

'Usage of the new Object
Browser("Google").Window("Google").WebElement(newObject).Click



    Second Method

The following syntax can be handy for one time usage of a Dynamic Object. In this method we set the properties of the dynamic object in the same line. This is another way of implementing the above example.


Browser("Google").Window("Google").WebElement("html tag:=SPAN", "class:=radio-classic-ITEM-OFF", "text:=" & Parameter("Text")).Click

flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert