In web applications, we can find the webedit objects in 2 ways.
set col = Browser("index:=0").page("index:=0").object.getElementsByTagName("input")
msgbox col.length
For i=0 to col.length-1
If col(i).getAttribute("type") = "text" Then
cnt = cnt +1
End If
Next
print cnt
- using QTP childobjects method
- using html DOM
using QTP childobjects method
Set oDesc = Description.Create()
oDesc("micclass").Value = "WebEdit"
'identify objects inside parent page having micclass as Webedit
set col = ObjParent.childobjects(oDesc)
'print the count of edit boxes on the page.
msgbox col.count
using HTML DOM
msgbox col.length
'Above code will give all objects starting with input tag. You can filter those having type = text using below code.
For i=0 to col.length-1
If col(i).getAttribute("type") = "text" Then
cnt = cnt +1
End If
Next
print cnt
'above code print the type attribute value. If it is text, that means given control is edit box.
Please give your inputs, suggestions, feedback to Us about above QTP topic. We value your thoughts. You can write to me at reply2sagar@gmail.com
Please give your inputs, suggestions, feedback to Us about above QTP topic. We value your thoughts. You can write to me at reply2sagar@gmail.com
No comments:
Post a Comment
Please Leave your reply. We value your feedback and inputs