It’s been a busy week in the Pagetest scripting engine…
First, I finally added support for combining multiple script steps into a single sequence (particularly necessary for doing a video comparison of multiple steps):
http://www.webperformancecentral.com/wiki/WebPagetest/Scripting#combineSteps
Here is a test that merges loading Google then Yahoo then AOL: http://www.webpagetest.org/result/101211_7801ffaffc016e82c11a03187f429fd5/
Along with a filmstrip for good measure: http://www.webpagetest.org/video/compare.php?tests=101211_7801ffaffc016e82c11a03187f429fd5-r:1-c:0
This is the script:
combineSteps
navigate www.google.com
navigate www.yahoo.com
navigate www.aol.com
Next (and I’m REALLY excited about this one), I have created a Javascript interface into Pagetest that page code can talk to. Right now there are only 2 methods but this opens up a lot of future possibilities:
The two methods are:
window.webpagetest.done() - If WebPagetest is running a script that tells it to wait for JS done this will end the test (see below)
window.webpagetest.message(“message string”) - This will send a timestamped message to the browser status messages (visible at the bottom of the screen shot page)
I have a sample page at http://www.patrickmeenan.com/test/dom/test.html that sends a message to the status window, sets a 15 second timer and then in the timer routine sends another message and calls done()
Here is what the result looks like:
http://www.webpagetest.org/result/101210_6d9129362071c01d9b08cb4afae1306f/ (notice the 15 second fully loaded time).
The messages that were logged from the javascript are visible here: http://www.webpagetest.org/result/101210_6d9129362071c01d9b08cb4afae1306f/1/screen_shot/ (scroll to the status messages below the screen shots).
The script command to force the test to wait is “waitForJSDone”. Here is the script that I used for the test:
waitForJSDone
navigate http://www.patrickmeenan.com/test/dom/test.html