Monday, January 25, 2016

Link Methods in QTP/UFT:

Exist
Description: Exist method is used to check whether an object is present in the application or not.
Syntax: ObjLink.Exist
Return Type: A Boolean Value
Example1: Dim Var
Var = Browser(“Browser”).Page(“Page”).Link(“Link”).Exist
Example2: Dim ObjLink
Set ObjLink = Description.Create
ObjLink(“MicClass”). Value = “Link”
ObjLink(“Text”).Value = “TestLink”
Var = Browser(“Name:=Browser”).Page(“Title:=Page”).Link(ObjLink).Exist
Msgbox var                                     ‘Display True / False
---------------------------------------------------------
Click
Description: Click method is used to click on the link present in the application.
Syntax: ObjLink.Click
Return Type: None
Example1:  Browser(“Browser”).Page(“Page”).Link(“Link”).Click
Example2: Dim ObjLink
Set ObjLink = Description.Create
ObjLink(“MicClass”). Value = “Link”
ObjLink(“Text”).Value = “TestLink”
Browser(“Name:=Browser”).Page(“Title:=Page”).Link(ObjLink).Click
----------------------------------------------------------------------------------------------
GetROProperty
Description: GetROProperty method is used to get the current value of an object at run time.
Syntax: ObjLink.GetROProperty(“Property_Name”)
Return Type: Variant Value
Example1: Dim Var_Name
Var_Name = Browser(“Browser”).Page(“Page”).Link(“Link”).GetROProperty(“Text”)
Example2: Dim ObjLink, Var_Name
Set ObjLink = Description.Create
ObjLink(“MicClass”). Value = “Link”
ObjLink(“Text”).Value = “TestLink”
Var_Name = Browser(“Name:=Browser”).Page(“Title:=Page”).Link(ObjLink).GetROProperty(“Text”)
Msgbox Var_Name    
----------------------------------------------------------------------------------------------
CaptureBitmap
Description: CaptureBitmap method is used to capture a screen of the object present in the application.
Syntax: ObjLink.CaptureBitmap(“FilePath”)
Return Type: None
Example1:  Browser(“Browser”).Page(“Page”).Link(“Link”).CaptureBitmap(“C:\FileName.png”)
Example2: Dim ObjLink
Set ObjLink = Description.Create
ObjLink(“MicClass”). Value = “Link”
ObjLink(“Text”).Value = “TestLink”

Browser(“Name:=Browser”).Page(“Title:=Page”).Link(ObjLink).CaptureBitmap(“C:\FileName.bmp”)

No comments:

Post a Comment