03-16-2012, 09:08 AM
Hi,
I am facing a problem here. We are automating a web portal and we use key word driven framework. We have some libraries and we call the functions through an excel with the properties of components(button,checkbox,Link etc) as parameter.
So when I say properties, I am parameterizing any one of the property of combinations of two.
For Eg:
In this function for checkbox I am using html id . So my doubt is that can we use html id for all the components in a portal. Will QTP identifies an object only with the help of only html id.
Please help me in this
I am facing a problem here. We are automating a web portal and we use key word driven framework. We have some libraries and we call the functions through an excel with the properties of components(button,checkbox,Link etc) as parameter.
So when I say properties, I am parameterizing any one of the property of combinations of two.
For Eg:
Code:
Function SetWebCB(setting_name,setting_value)
Browser("Browser").Page("Page") .WebCheckBox("WebCheckBox").SetTOProperty "html id",setting_name
If Browser("Browser").Page("Page").WebCheckBox("WebCheckBox").Exist Then
If Browser("Browser").Page("Page")System").WebCheckBox("WebCheckBox").GetROProperty("disabled") = 0 Then
checked = Browser("Browser").Page("Page").WebCheckBox("WebCheckBox").GetROProperty("checked")
If setting_value = "ON" Then
If checked = 0 Then
Browser("Browser").Page("Page").WebCheckBox("WebCheckBox").Set setting_value
SetWebCB = 1
Else
SetWebCB = 0
Call write_result(1, "Object "&setting_name&" is already checked","Comments")
End If
ElseIf setting_value = "OFF" Then
If checked=1 Then
Browser("Browser").Page("Page").WebCheckBox("WebCheckBox").Set setting_value
SetWebCB = 1
Else
SetWebCB = 0
Call write_result(1, "Object "&setting_name&" is already unchecked","Comments")
End If
Else
SetWebCB = 0
Call write_result(1, "The Parameter should be either ON/OFF","Comments")
End if
Else
SetWebCB = 0
Call write_result(1, "Object "&setting_name&" is disabled","Comments")
End If
Else
SetWebCB = 0
Call write_result(1, "Object "&setting_name&" does not exist","Comments")
End If
End Function
In this function for checkbox I am using html id . So my doubt is that can we use html id for all the components in a portal. Will QTP identifies an object only with the help of only html id.
Please help me in this