WORKING WITH QTP

TestEveryThinG

Archive for May, 2011

Highlight the text on page using the QTP

Posted by rajivkumarnandvani on May 25, 2011

Hi All,

Someone asked me how to highlight the text on page using the QTP. So here I have created a function that will find the text on page and highlight it if finds else not.

REM  ——  Set page object     ———
set objpage = Browser(“BrowserName”).Page(“Pagename”)
call   HighLightTextPresentOnPage(objpage ,”News” )
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
Next
           If allobj.count > 0 then
              HighLightTextPresentOnPage = true
           Else
              HighLightTextPresentOnPage = false
           End if
             On Error GoTo 0
End Function

Posted in QTP, WEB | 1 Comment »

Started New Blog on blogspot

Posted by rajivkumarnandvani on May 11, 2011

Hi ALL,

I have started my new blog about QTP  on google blog spot.

here is the link

http://testeverythingqtp.blogspot.com/

Posted in FAQ QTP | Leave a Comment »