Current time: 02-26-2020, 06:23 PM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Browser closing before the page is loaded completely
07-24-2014, 07:16 AM
Post: #3
RE: Browser closing before the page is loaded completely
I am looking for creative ways to tell WPT that my page is done loading without a wholesale extension of the timeout value with setActivityTimeout.

First I tried using setDOMElement looking for a class, but the DOM has a list of classes and I only know of one for sure (tested it with the one I know about but it didn't seem to work).

Next I was hoping to combine setDOMElement with exec like this (spaces and indention added for readability):

Code:
setDOMElement id=wptDoneLoading
exec            var wptInterval = setInterval(function () {
                       console.log('setInterval');
                       var domElements = document.getElementsByClassName('x4-grid-tree-node-leaf');
                       console.log('domElements: '+domElements+ ', length: '+domElements.length);
                       if (domElements && domElements.length > 0) {
                           console.log('in the if');
                           var el = document.createElement("div");
                           el.id = 'wptDoneLoading';
                           document.body.appendChild(el);
                           clearInterval(wptInterval);
                       }
                   }, 250);

That didn't work, so I tried changing the ID of an existing DIV in the same manner but that also didnt work. My last attempt is only valid for IE (according to the docs) but it is also not working because window.webpagetest doesnt seem to exist:

Code:
waitForJSDone
exec            var wptInterval = setInterval(function () {
                       console.log('setInterval');
                       var domElements = document.getElementsByClassName('x4-grid-tree-node-leaf');
                       console.log('domElements: '+domElements+ ', length: '+domElements.length);
                       if (domElements && domElements.length > 0) {
                           if( window.webpagetest ) {
                               console.log('calling window.webpagetest.done');
                               window.webpagetest.done();
                           } else {
                               console.log('no webpagetest object to call done on!');
                           }
                           clearInterval(wptInterval);
                       }
                   }, 250);

I am using AMIs ami-04320e41 and ami-92320ed7. Any assistance would be appreciated, thanks!

Doc Reference:
https://sites.google.com/a/webpagetest.o...DOMElement
https://sites.google.com/a/webpagetest.o...tForJSDone
https://sites.google.com/a/webpagetest.o...g#TOC-exec
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Browser closing before the page is loaded completely - pherris - 07-24-2014 07:16 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)