WebPagetest Forums
Cannot get scripted test to run - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: WebPagetest (/forumdisplay.php?fid=7)
+--- Forum: Bugs/Issues (/forumdisplay.php?fid=10)
+--- Thread: Cannot get scripted test to run (/showthread.php?tid=14393)



Cannot get scripted test to run - allroadcole - 07-06-2016 01:03 PM

Hello,

I have been trying for several days to test a page that is behind an authentication wall.

I've tried various scripted test, all on a Private Instance.

First I was using scripts similar to the examples:

Code:
// turn off logging
logData    0

// bring up the login screen
navigate    https://www.company.com/login

// log in
setValue    name="userid"    user@company.com
setValue    name="password"    pa$$word
submitForm    id="loginForm"
// also tried
//clickAndWait    id="btnlogin"

// turn on logging
logData    1

// navigate to page we want to measure
navigate    https://www.company.com/slowpage.html

However, I could not get the login to work. The test would always show the login page.

The closest I've got is the following script, which kind of works in IE, but doesn't work in Chrome. The following script actually loads the slowpage.html I'd like to test in IE, but only partially; also, I need to emulate mobile devices so I need to use Chrome. In Chrome I always get "The testing completed but failed. Skipped repeat view, first view failed: Test run failed with result code -1".

Code:
combineSteps

// bring up the login screen
navigate    https://www.company.com/login

// log in using jQuery, this code does work in the console
exec    $('input#userID').val("user@company.com"); $('input#password').val("pa$$word"); $('button#btnlogin').click()

//wait 10 seconds
sleep    10

// navigate to page we want to measure
navigate    https://www.company.com/slowpage.html

Any other tips or tricks? Suggestions on how to debug?

Any advice is appreciated.

Thanks,


RE: Cannot get scripted test to run - rviscomi - 07-17-2016 06:17 PM

Try logging in manually and saving the authentication cookie. Then use WPT scripting to set the auth cookie and navigate directly to the page you want to test. The script is two lines and you don't have to worry about a warm cache.

See this post for more info: http://calendar.perfplanet.com/2015/using-webpagetest-authentication/