Via the web interface I can easily add a script that will be visible on the results page afterwards (if I click “More” in the header). But if I send the same script via the URL parameter it doesn’t show up and so I’m not sure if the script was running.
From this URL:
https://www.webpagetest.org/runtest.php?url=https://www.example.com&k={api_key}&f=json&location=ec2-eu-central-1:Chrome.4G&runs=3&mobile=1&mobileDevice=MotoG4&script=setCookie https%3A%2F%2Fwww.example.com cookie-name%3D1
navigate https%3A%2F%2Fwww.example.com
I expect to see this script on the results page:
setCookie https://www.example.com cookie-name=1
navigate https://www.example.com
… but I don’t. Why not?
It looks like you urlencoded the URLs in the script but not the whole script string itself. it should be:
script=setCookie%09https%3A%2F%2Fwww.example.com%09cookie-name%3D1%0Anavigate%09https%3A%2F%2Fwww.example.com```