Hi
I have a Moodle website that I want to log into and then measure a page load speed.
I have been using the following script to achieve this:
logData 0
navigate https://edu.eupati.eu/login/index.php
sleep 15
logData 0
setValue id=username xxxxxxxxxxxxx
setValue id=password xxxxxxxxxxxxx
submitForm name=login
sleep 15
logData 1
navigate https://edu.eupati.eu/mod/book/view.php?id=1197&chapterid=773
I replaced the username and passwords with the actual username and password or should they be encoded?
I cannot seem to get past the login page.
Any help you can give me is greatly appreciated.
Thanks
J
So I mostly use the exec script command to manipulate DOM elements when I script these days so I’d do something like this for the above case
logData 0
navigate https://edu.eupati.eu/login/index.php
sleep 15
logData 0
exec document.getElementById(‘username’).value=‘xxxxxx’
exec document.getElementById(‘password’).value=‘xxxxxx’
execAndWait document.getElementById(‘loginbtn’).click()
sleep 15
logData 1
navigate https://edu.eupati.eu/mod/book/view.php?...pterid=773
Thanks a million for your help Andy.
Your script is working as intended now.
Thanks again
J
This is an excellent example, thank you for posting this. It would be worth adding this as an example in the docs - https://sites.google.com/a/webpagetest.org/docs/using-webpagetest/scripting#TOC-MyAOL-Authenticated-profile