Current time: 09-17-2014, 03:27 AM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sending script down to runtest.php
01-11-2013, 09:34 PM
Post: #1
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 <my first url>\nsetValue name=signIn_emailAddress <my email>\nsetValue name=signIn_password <password>\nclickAndWait name=signIn_signInButton

this works ok:
POST
name=script value=navigate <my first url>

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
Find all posts by this user
Quote this message in a reply
01-12-2013, 12:49 AM
Post: #2
RE: Sending script down to runtest.php
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).
Visit this user's website Find all posts by this user
Quote this message in a reply
01-12-2013, 03:03 AM
Post: #3
RE: Sending script down to runtest.php
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%5Cnnavigate%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"?>
<response>
<statusCode>400</statusCode>
<statusText>Please enter a Valid URL. <b>http://www.webwob.com/index.html\nnavigate http://www.webwob.com/html/faq.html</b> is not a valid URL</statusText>
<requestId>12345</requestId>
</response>

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%5Cn

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.o...stful-apis) doesn't give any details and line 958 on this page (http://code.google.com/p/webpagetest/sou...php?r=1614) suggests that the script should be split on "\n".

Thanks for any help on this,
Nick
Find all posts by this user
Quote this message in a reply
01-12-2013, 04:33 AM
Post: #4
RE: Sending script down to runtest.php
Your GET request is not properly URL Encoded. Here is a site I usually use to try things out: http://meyerweb.com/eric/tools/dencoder/

Here is what it should look like:
Code:
/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
Visit this user's website Find all posts by this user
Quote this message in a reply
01-14-2013, 09:03 PM
Post: #5
Wink RE: Sending script down to runtest.php
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
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)