Scripting to trap page requests

I have a question around scripting.

I am logging on to a website, and when I press the Login button, want to trap how long the page takes to load.

The problem is that its Ajax and WPT tells me a page has loaded when the 3 graphs are still loading.

One of them takes longer and is a specific request that I can see (https://www.mywebsite.com/DisplayChart), so I thought it would be the case that I need to capture this request and only measure Document Complete when the request is complete, but no joy.

This is the code structure:

logData 0
navigate https://www.mywebsite.com

// log in
setValue name=AuthenticationUserName myuser
setValue name=AuthenticationPassword mypassword

logData 1
setDOMRequest https://www.mywebsite.com/DisplayChart name=AuthenticationLoginButton

If anyone can point me in the right direction it would be appreciated, thanks.

Steve

Which browser do you use? The command setDOMRequest is just supported for IE (and I think only if you use urlblast). Thus, for other browsers (and IE measurements with wptdriver) you can’t use the setDOMRequest command.

Alternative approach:
You can search for a specific dom element that is only available if the request is completed and use the setDOMElement command instead. This command is supported for all browsers.

Hi

I am using IE9, so it should work.

I also realised the script wasnt copied in properly as I am using this:

logData 0
navigate https://www.mywebsite.com

// log in
setValue name=AuthenticationUserName myuser
setValue name=AuthenticationPassword mypassword

logData 1
setDOMRequest https://www.mywebsite.com/DisplayChart
clickAndWait name=AuthenticationLoginButton

I changed to use setDOMElement to look for a class name of the widget that usually takes the longest to load, but I have a problem - there is a transparent layer over the widgets which is removed when you close a message box. The problem is that the message box can be closed even while the widget is still loading. I tried closing the message box in the script, so I could use the SetDOMElement command, but this just made the test think that the screen had loaded when I closed the message box, so I still get incorrect page load times.

The alternative is me was to work off of the page requests. WPT knows what requests are being made as it shows me them in the results, so I figured it would be better to flag that a page is deemed as loaded when the specific request has completed. It sounds so simple to type it, yet seems very difficult to achieve!