WebPagetest Forums
Script Windows Live ID Login? - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: WebPagetest (/forumdisplay.php?fid=7)
+--- Forum: Bugs/Issues (/forumdisplay.php?fid=10)
+--- Thread: Script Windows Live ID Login? (/showthread.php?tid=687)



Script Windows Live ID Login? - nitucker - 04-19-2011 11:59 AM

My site allows users to login with a Windows Live ID, but I'm having some trouble automating login. I've tried it using the pagetest browser plug-in so I could get some debugging info and it fails on my attempt to submitForm / click (I tried both ways).

Am I doing something wrong here? The below script repros the issue on the live.com homepage with a test account I setup just for this post.

Code:
logData    0

// bring up the login screen
navigate    http://www.live.com

// log in
setValue    name=login    wpt-test@live.com
setValue    name=passwd    123456
//click id=idSIButton9
submitForm    submitName=f1

logData    1

Thanks,
Nick


RE: Script Windows Live ID Login? - pmeenan - 04-20-2011 12:31 AM

Try this:

Code:
logData    0
navigate    https://login.live.com
logData    1
setValue    name=login    wpt-test@live.com
setValue    name=passwd    123456
setValue    name=remMe    0
clickandWait    id=idSIButton9

You'll need to move the "logData 1" to the end and add whatever navigation you actually want to measure after the login but the login itself worked for me: http://www.webpagetest.org/result/110419_5S_7660fd5b07aba3b6624231c4bd1d79f7/


RE: Script Windows Live ID Login? - nitucker - 04-20-2011 03:03 AM

Ack, I feel so silly. It was because I had a space instead of a tab between the action and button ID! It might be a nice feature if the script parser accepted either (assuming there isn't a case where a space is used, I haven't read all of the scripting documents).

Thanks for the working version of the script!


RE: Script Windows Live ID Login? - pmeenan - 04-20-2011 03:13 AM

It should be able to parse scripts with spaces if you are using the web UI (on the public instance). I'll check the logic and make sure it can also deal with multiple spaces in case that tripped it up.


RE: Script Windows Live ID Login? - nitucker - 04-20-2011 03:44 AM

I was using the brower plugin to test that the scripts worked. Haven't actually tried it through the web UI yet (I'm using a private instance). I only had a single space, I reproduced the issue with your script by deleting the tab and adding a single space.


RE: Script Windows Live ID Login? - nitucker - 04-20-2011 04:54 AM

Hmm, so I'm trying to execute via the web UI and it seems the script has trouble on repeat view for my site. I don't think you'll be able to repro on Live.com since we're using an option in the API to turn off the user boxes and just display the same form again (it has the same IDs and everything, just has username pre-populated).
  1. Do scripts execute on the repeat view?
  2. Will the script clear a textbox that already has a value in it? On repeat view, my username is still in the login box.



RE: Script Windows Live ID Login? - pmeenan - 04-20-2011 04:58 AM

Sorry, the browser plugin doesn't have the script scrubbing logic (and the private instance code doesn't have it yet either).

Scripts do execute for repeat view tests but cookies aren't cleared between runs so you usually need to log out as part of the script so that the repeat view script can execute all of the steps. I don't (yet) have a good way to allow the repeat view to run a different sequence of steps. The script I uploaded unchecks the "remember me" box so the user name shouldn't be populated in that case.

Thinking about it a bit, I might be able to add a couple of commands to let you identify blocks of a script to run only in first view or only in repeat view (with the default block logic to run in both).


RE: Script Windows Live ID Login? - nitucker - 04-20-2011 05:22 AM

Hmm, watching closely, it seems that the line to disable Remember Me isn't working; the box remains checked. I ran through the scenario manually and when I uncheck it everything would go smoothly on a repeat run as the username isn't there.

I double-checked to make sure and the page I'm hitting does still have the name set to "remMe".

Any ideas? Obviously the default / first / repeat switch case could solve this, but it seems odd the checkbox is failing to update.


RE: Script Windows Live ID Login? - pmeenan - 04-20-2011 05:52 AM

It's possible that the setValue command isn't actually working on checkboxes and I was imagining things when I thought it was working Sad I don't have any commands in the language to explicitly set the checked state so getting it to work properly is probably going to require a code change either way. I'll see if I can whip something up quickly tomorrow.


RE: Script Windows Live ID Login? - pmeenan - 04-22-2011 04:49 AM

Sorry, got swamped with some other issues but I also remembered that you can execute arbitrary javascript so this looks like it works:

Code:
logData    0
navigate    https://login.live.com
logData    1
setValue    name=login    wpt-test@live.com
setValue    name=passwd    123456
exec    document.forms[0].remMe.checked = false;
clickandWait    id=idSIButton9

If there are things that you might want to do in one pass but not another and you want it to just gracefully skip over them you can also add:

Code:
ignoreErrors    1

Before the part of the code you expect to fail (like clicking on a button that is sometimes there but not always).