TESTEVERYTHING

Showing posts with label ChildObject. Show all posts
Showing posts with label ChildObject. Show all posts

Wednesday, 27 July 2011

VB Get All Web page text ( Including All Webelement )

Hi All,
Some Time we have to check that particular text is present on page or not during automation. If we get the page outer HTML in QTP we can not  get the whole text of all element like frame , webtable . div.etc…
So i created a function which will  check that the given text is present on page or not If Text present on page it will return True else False
REM  ——-   Set page object     ———-
set objpage = Browser(“BrowserName”).Page(“Pagename”)
msgbox   VerifyTextPresentOnPage(objpage ,”rajiv” )
Function VerifyTextPresentOnPage(byval objpage , byval Textvalue )
On error resume next

Monday, 23 May 2011

Close All Browsers Except OLD One QTP VB

Hi All,
Some times we required that Only OLD open Browser Window( Only for IE) will remain Open and rest of all should be closed during QTP scripting. Here is the Function which will close all the open Browsers except OLD Open browser (Work only for Internet Explorer using QTP)


Public function fn_CloseAllBrowsersExceptOLD
      rem create Browser description object

         Set brwsr=Description.Create

         brwsr(“micclass”).value=”Browser”

         Set obj=Desktop.ChildObjects(brwsr)

          browserCount= obj.count

         Set obj=nothing

         If  browserCount >1  Then

         do

            Browser(“CreationTime:=1″).Close

            Set obj=Desktop.ChildObjects(brwsr)

            browserCount= obj.count

            Set obj=nothing

         loop  until  browserCount =1

        End If
End Function

call  fn_CloseAllBrowsersExceptOLD( )

Translate







Tweet