Tuesday, January 26, 2016

WebList Methods in QTP/UFT:

Exist
Description: Exist method is used to check whether an object is present in the application or not.
Syntax: ObjList.Exist
Return Type: A Boolean Value
Example1: Dim Var
Var = Browser(“Browser”).Page(“Page”).WebList(“WebLink”).Exist
Example2: Dim ObjList
Set ObjList = Description.Create
ObjLink(“MicClass”). Value = “WebList”
ObjLink(“Text”).Value = “TestList”
Var = Browser(“Name:=Browser”).Page(“Title:=Page”).WebList(ObjList).Exist
Msgbox var                                     ‘Display True / False
---------------------------------------------------------
Click
Description: Click method is used to click on the weblist present in the application.
Syntax: ObjList.Click
Return Type: None
Example1:  Browser(“Browser”).Page(“Page”).WebList(“ObjList”).Click
Example2: Dim ObjList
Set ObjList = Description.Create
ObjList (“MicClass”). Value = “WebList”
Browser(“Name:=Browser”).Page(“Title:=Page”).WebList(ObjList).Click
----------------------------------------------------------------------------------------------
GetROProperty
Description: GetROProperty method is used to get the current property value of an object at run time.
Syntax: ObjList.GetROProperty(“Property_Name”)
Return Type: Variant Value
Example1: Dim Var_Name
Var_Name = Browser(“Browser”).Page(“Page”).Weblist(“ObjList”).GetROProperty(“InnerText”)
Msgbox Var_Name
Var_Name = Browser(“Browser”).Page(“Page”).Weblist(“ObjList”).GetROProperty(“Items Count”)
Msgbox Var_Name
Var_Name = Browser(“Browser”).Page(“Page”).Weblist(“ObjList”).GetROProperty(“Selected item index”)
Msgbox Var_Name
Var_Name = Browser(“Browser”).Page(“Page”).Weblist(“ObjList”).GetROProperty(“Selected Items Count”)
Msgbox Var_Name
Var_Name = Browser(“Browser”).Page(“Page”).Weblist(“ObjList”).GetROProperty(“Selection”)
Msgbox Var_Name
Var_Name = Browser(“Browser”).Page(“Page”).Weblist(“ObjList”).GetROProperty(“visible”)
Msgbox Var_Name
Var_Name = Browser(“Browser”).Page(“Page”).Weblist(“ObjList”).GetROProperty(“Value”)
Msgbox Var_Name
Example2: Dim ObjList, Var_Name
Set ObjLink = Description.Create
ObjList (“MicClass”). Value = “WebList”
Var_Name = Browser(“Name:=Browser”).Page(“Title:=Page”).WebLink(ObjList).GetROProperty(“InnerText”)
Msgbox Var_Name    
----------------------------------------------------------------------------------------------
Select
Description: Select method is used to select item from the weblist.
Syntax: ObjList.Select(“Item”)
Return Type: None
Example1: Browser(“Browser”).Page(“Page”).WebList(“WebList”).Select (“Item”)
Example2: Dim ObjList
Set ObjList = Description.Create
ObjLink(“MicClass”). Value = “WebList”
Browser(“Name:=Browser”).Page(“Title:=Page”).WebList(ObjList).Select(“Item”)
-----------------------------------------------------------------------
Deselect
Description: Deselect method is used to deselect item from the weblist.
Syntax: ObjList.Deselect(“Item”)
Return Type: None
Example1: Browser(“Browser”).Page(“Page”).WebList(“WebList”).Deselect (“Item”)
Example2: Dim ObjList
Set ObjList = Description.Create
ObjLink(“MicClass”). Value = “WebList”
Browser(“Name:=Browser”).Page(“Title:=Page”).WebList(ObjList).Deselect(“Item”)
---------------------------------------------------------------------------------
GetItem
Description: GetItem method is used to get the item value based on the specified item index from the weblist.
Syntax: ObjList.GetItem(index_value)
Return Type: A variant value
Example1: Dim Var_Value
Var_Value = Browser(“Browser”).Page(“Page”).WebList(“WebList”).GetItem(2)
Example2: Dim ObjList, Var_Value
Set ObjList = Description.Create
ObjLink(“MicClass”). Value = “WebList”
Var_Value = Browser(“Name:=Browser”).Page(“Title:=Page”).WebList(ObjList).GetItem(2)
Msgbox Var_Value
----------------------------------------------------------------------------
CaptureBitmap
Description: CaptureBitmap method is used to capture a screen of the object present in the application.
Syntax: ObjList.CaptureBitmap(“FilePath”)
Return Type: None
Example1:  Browser(“Browser”).Page(“Page”).Link(“ObjList”).CaptureBitmap(“C:\FileName.png”)
Example2: Dim ObjList
Set ObjList = Description.Create
ObjList (“MicClass”). Value = “WebList
ObjList (“InnerText”).Value = “TestList”

Browser(“Name:=Browser”).Page(“Title:=Page”).WebList(ObjList).CaptureBitmap(“C:\Name.bmp”)

No comments:

Post a Comment