"working" a web site from Rev

Dave Cragg dcragg at lacscentre.co.uk
Tue Aug 16 18:11:28 EDT 2005


On 16 Aug 2005, at 22:29, Jon wrote:

> I want to write a Rev program to make sure that a web site I've  
> written is still functioning correctly, perhaps once an hour,  
> 24/7.  The manipulations for a person are pretty simple:
>
> 1) go to a fixed URL
> 2) click a button
> 3) go to the bottom of the page
> 4) check a check box
> 5) click a button
> 6) verify that the received HTML contains some key phrases.

Are steps 2 and 4 both form submission buttons?

Anyway, if you are trying to check that the form submission is  
working, you should be able to check this directly from Rev without  
opening a browser.

Depending on the form's method (GET or POST) you would use get url or  
post. For example, say the form had the following fields:

Field 1 name = "name"; value = "Jon"
Field 2 name = "happy"; value = "true"

You could construct the form data like this:

   put "Jon" into tName
   put "true" into tHappy
   put libUrlFormData("name",tName,"happy",tHappy) into tFormData

If you are using "get", then you would append the form data to the  
url like this:

    put "http://www.mysite.com/myform.cgi" & "?" & tFormData into tUrl
    put url tUrl into tReturnedHtml
    if the result is empty then
       ##parse tReturnedHtml for key phrases
    else ##error
      answer the result
    end if

If you are using "post", then like this:

    post tFormData to url "http://www.mysite.com/myform.cgi"
    if the result is empty then
       put it into tReturnedHtml
       ##parse tReturnedHtml for key phrases
    else ##error
      answer the result
    end if

Hope that helps
Dave




More information about the use-livecode mailing list