Saturday, June 23, 2012

Function: HighLightTextPresentOnPage


Function HighLightTextPresentOnPage(byval objpage , byval Textvalue )
On error resume next
REM ——- Create child object description
Set childobj = Description.Create()
childobj("micclass").value="WebElement"
childobj("html tag").value=".*[A-Za-z0-9].*"
childobj("outertext").value =Textvalue
REM  ———-Create ALL child object
set allobj = objpage.ChildObjects(childobj)
 REM here highlight method we will use that is in build in QTP for object
For i=1 to allobj.count-1
    allobj.Item(i).HighLight
 Wait 5
Next
           If allobj.count > 0 then
              HighLightTextPresentOnPage = true
     Wait 5
           Else
              HighLightTextPresentOnPage = false
           End if
             On Error GoTo 0
End Function