Forum Discussion

david_quick's avatar
david_quick
Occasional Contributor
11 years ago

Event Handling in Chrome 32

I have:



1. OnWebPageDownloaded enabled and calling a script.

2. A test that interacts with objects on the page causing it to refresh



This works fine in IE9 i.e. the script is called, however the script is not called (event is not triggered) when using Chrome 32.  The test works in both IE and Chrome.

I have searched the forum but cannot find a similar issue, am I missing a setting?



Update: Same issue occurs in Firefox v27

6 Replies

  • david_quick's avatar
    david_quick
    Occasional Contributor
    Just found this in the help documentation under OnWebPageDownloaded :












    This event is fired only for the Internet Explorer web browser and web browsers based on the Microsoft WebBrowser control. It does not occur for the other supported browsers.

    Oops!



    Does anyone know how to trigger a page download event in Chrome and FF?
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi David,



    You may try the following code to wait for the page to be downloaded into the browser.

    Note: The below code does not wait until the browser processes jscript code on the page and generates the objects that might be absent in the original html. (OnWebPageDownloaded event is also triggered before script code is processed.) So, you must wait additionally for the object you need if it is generated during runtime by page's script code on the client.



      If ("iexplore" = Aliases.browser.ObjectIdentifier) Then

        PageObject.Wait

        While 4 <> PageObject.readyState

    '        w := PageObject.Parent.WaitWindow('#32770', '*', -1, 500);

    '        if (w.Exists) then

    '          w.Close;

          Call aqUtils.Delay(500, "Waiting for the page to load from the web server...")

        Wend

      Else

        Do Until aqObject.IsSupported(PageObject, "contentDocument")

          Call aqUtils.Delay(500, "Waiting for the page to load from the web server...")

        Loop

        Do Until BuiltIn.varDispatch = aqObject.GetVarType(PageObject.contentDocument) 'PageObject.contentDocument Is Nothing

          Call aqUtils.Delay(500, "Waiting for the page to load from the web server...")

        Loop

        Do Until aqObject.IsSupported(PageObject.contentDocument, "readyState")

          Call aqUtils.Delay(500, "Waiting for the page to load from the web server...")

        Loop

        Do Until BuiltIn.varOleStr = aqObject.GetVarType(PageObject.contentDocument.readyState)

          Call aqUtils.Delay(500, "Waiting for the page to load from the web server...")

        Loop

        Do Until "complete" = PageObject.contentDocument.readyState

    '        w := PageObject.Parent.WaitWindow('#32770', '*', -1, 500);

    '        if (w.Exists) then

    '          w.Close;

          Call aqUtils.Delay(500, "Waiting for the page to load from the web server...")

        Loop

      End If

  • david_quick's avatar
    david_quick
    Occasional Contributor

    Thanks for the response Alexei.


     


    Is there a way for TestComplete to trigger the above code without having to insert a call to the script in the Test after each page load?



    My issue isn't so much as waiting for the page to load it's more with having a way to automatically trigger a script based on an event.


     

  • david_quick's avatar
    david_quick
    Occasional Contributor
    I did read that and found a third party Active X plugin for Chrome (in the Google store) and this worked initially, however I cannot get it to reliably call the script.  I'll keep trying!
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    David,



    Thank you for the update with the ActiveX for Chrome.

    It would be also good to know whether or not you succeed with what you'd like to implement.