Posts: 12
Threads: 8
Joined: Mar 2011
Reputation:
0
03-16-2011, 02:43 PM
I have 10 Webedit and 2 Weblist fields in the web application page. I need QTP to
(a) Validate their existence on the page and if yes, check if they are greyed out (disabled)
(b) Compare the values against a global datasheet
Could you please help me write a generic function which can be used to do (a) and (b) for different web objects like WebEdit, WebList, Radiobutton etc?
Thanks a ton!
Liju
Posts: 1,003
Threads: 1
Joined: Jul 2009
Reputation:
5
03-16-2011, 02:44 PM
Would you paste the code you have tried so far? Would be easier to correct it.
Furthermore, you dont have to consider how many webedits and weblists are on the webpage. You can make it very generic, such as, you pass the object and it should check for the conditions you have.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Posts: 1,003
Threads: 1
Joined: Jul 2009
Reputation:
5
03-16-2011, 03:14 PM
See if this works,
Code:
Dim QuoteName
Set QuoteName = Browser("IPSDK WEB GUI (Search)").Page("Customer Info").Frame("Quote Header").Table("Quote_Header_Table").WebEdit("Quote_Name")
If ExistsAndDisabled(QuoteName) Then
Reporter.ReportEvent micPass, "Checking Object Status", QuoteName.GetTOProperty("html id") & " was found and disabled."
Else
Reporter.ReportEvent micFail, "Checking Object Status", QuoteName.GetTOProperty("html id") & " was either not found or disabled."
Quote_Name=QuoteName.GetROproperty("value")
Quote_Name_value = DataTable.Value("Quote_Name", GLOBAL)
CheckValue Quote_Name, Quote_Name_value
End If
Public Function ExistsAndDisabled(test_object)
ExistsAndDisabled=True
If test_object.Exist Then
If test_object.GetROProperty("enabled")= "True" Then
ExistsAndDisabled=False
End If
Else
ExistsAndDisabled=True
End If
End Function
Public Function CheckValue(str1, str2)
If strcomp (str1, str2) =0 Then
Reporter.ReportEvent micPass, "Checking object value", str1 & "was found"
End If
End Function
Honestly, i dont have the time to refine your function, however the above should work for your tweaked purpose. I will try and work on it during my free time, however no promises
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Posts: 1,003
Threads: 1
Joined: Jul 2009
Reputation:
5
03-16-2011, 05:22 PM
Its called registeruserfunc. You can register userdfined function against objects. Search and learn about it.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.