Sending script down to runtest.php

Hi,

I’ve been using webpagetest for a long time, scripting Jmeter and Jenkins to get CI perf graphs and it’s great. But now I need to send a webpagetest script down to runtest.php

I’m posting the name value pair ‘script’ but I can only get it to work for a one line script.

I want to navigate to a page, enter some log in info and press the log in button. The script works manually but in the POST, the first navigate key word wants to take the whole script as it’s input. I’ve tried \n and \r to specify new lines but am not getting anywhere.

How would I get this to work for example:

POST
name=script value=navigate \nsetValue name=signIn_emailAddress \nsetValue name=signIn_password \nclickAndWait name=signIn_signInButton

this works ok:
POST
name=script value=navigate

and if I add the \n on the end of that, it just shows up in the browser on the end of the url…

Thanks,
Nick

I believe the POSTs are usually expecting to be mime encoded but I’ve never looked to be honest - you can watch what your browser posts to see what is going on. You can send it through get as a query param as well, just make sure to urlencode it (that is the most common cause for API calls failing).

I have tried GET as well and here’s a simpler example. Any ideas on getting this working?

sent this down:
GET /runtest.php?url=http://webwob.com/index.html&runs=1&f=xml&r=12345&fvonly=1&location=Office_wptdriver:Chrome&noimages=1&script=navigate%20http://www.webwob.com/index.html\nnavigate%20http://www.webwob.com/html/faq.html HTTP/1.1

with these headers:
MIME-version: 1.0 (generated by my-application 1.2)
Content-Type: multipart/mixed

but got back:

<?xml version="1.0" encoding="UTF-8"?> 400 Please enter a Valid URL. http://www.webwob.com/index.html\nnavigate http://www.webwob.com/html/faq.html is not a valid URL 12345

Again, if I simplify this to:
GET /runtest.php?url=http://webwob.com/index.html&runs=1&f=xml&r=12345&fvonly=1&location=Office_wptdriver:Chrome&noimages=1&script=navigate%20http://www.webwob.com/index.html\n

that last \n is appended to the url

Any ideas on getting the ‘\n’ used to split up the script?

This page (https://sites.google.com/a/webpagetest.org/docs/advanced-features/webpagetest-restful-apis) doesn’t give any details and line 958 on this page (Google Code Archive - Long-term storage for Google Code Project Hosting.) suggests that the script should be split on “\n”.

Thanks for any help on this,
Nick

Your GET request is not properly URL Encoded. Here is a site I usually use to try things out: URL Decoder/Encoder

Here is what it should look like:

/runtest.php?url=http%3A%2F%2Fwebwob.com%2Findex.html&runs=1&f=xml&r=12345&fvonly=1&location=Office_wptdriver:Chrome&noimages=1&script=navigate%09http%3A%2F%2Fwww.webwob.com%2Findex.html%0Anavigate%09http%3A%2F%2Fwww.webwob.com%2Fhtml%2Ffaq.html

Thanks. I had used a similar encoding site but had typed \n into notepad myself. Now, when I cut and paste from notepadd++ with it’s own carriage returns, it looks like your example below. This is great! Thank you so much for the support. It’s working and I can now automate a proper workflow.

Kind regards,
Nick