Wednesday

QTP - Wait for web page to load completely



 There are instances when there isn't any unique property or object to check on the landing page during a browser navigation, in such cases we can use either of the below options to code:

set objReadyState = Browser("").Page("").Object
While objReadyState.readyState = "Completed"
Wend
Set Object=nothing


Set Object=Browser("").object
While Object.Busy=True
Wend
Set Object=nothing

Happy Testing!

7 comments:

  1. Thanks for sharing.

    It's very useful for all.

    QTPbook

    ReplyDelete
  2. am new vb scripts. Where do i add this portion for the script below

    Sub IEPageLoad(obj)
    Do while IE.busy
    WScript.Sleep 7000
    Loop
    End Sub


    set ie = WScript.CreateObject("InternetExplorer.Application")
    ie.navigate("https://ctmc.travelport.com")
    ie.visible = True

    IEPageLoad(IE)

    Set objShell = WScript.CreateObject("WScript.Shell")
    objShell.SendKeys "username"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "password"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "Global"
    objShell.SendKeys "{Enter}"
    WScript.Sleep 5000
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "{TAB}"
    WScript.Sleep 100
    objShell.SendKeys "{Enter}"

    ReplyDelete
  3. Anonymous29/8/12

    Dear Aditya Kalra,

    Thanks a lottttttttttttttttt, really awesome, its working perfect

    for this code i searched from past 1 1/2 year, finally i got it

    really thank you v v very much.

    Regards,
    G@vey0m

    ReplyDelete
  4. Thanks , Glad that helped!

    Best Regards,
    Ady.
    " Besides black art, there is only automation "
    Technology Specific Guide For QTP - My new Book on QTP

    ReplyDelete
  5. Anonymous28/6/13

    Since the admin of this website is working, no doubt very shortly it will be well-known, due to its quality contents.


    Here is my site; New Kobe Bryant Shoes

    ReplyDelete
  6. Is it worth adding extra condition to exit while?

    For example
    IF WaitTime > "27min" THEN exit while

    ReplyDelete
  7. Hey Sergiusz,
    In case you think that the application isn't stable, that's exactly what you should do to break out of the infinite loop. We generally add a statement that would do this for us especially if we are expecting to run a complete test suite.
    Best Regards,
    Ady

    ReplyDelete