Re: "working" a web site from Rev

2005-08-16 Thread Ken Ray
On 8/16/05 4:29 PM, "Jon" <[EMAIL PROTECTED]> 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.
> 
> Is it easy to do this in Rev?  Any sample stacks you can recommend?

Well, that actual button clicking can't be done with Rev, but you can
simulate it by passing the parameters with the url string that would
normally be sent when you click the button in a ' get url ' call. For
example, suppose I had a simple form on a web page for name and email
address with a "submit" button. When the submit button is clicked, it sends
that data to the CGI on the server (let's say it's
"www.123.com/cgi-bin/testcgi"). I could simulate the submit button for the
person "Test" with email address "test@test.com" like this:

put urlEncode("Test") into tName
put urlEncode("test@test.com") into tEmail
get url("http://www.123.com/cgi-bin/testcgi?"; & tName & "&" & tEmail)

--> now "it" contains the source of the page that would be displayed after
the submit button was pressed

Hope this helps...


Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [EMAIL PROTECTED]


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "working" a web site from Rev

2005-08-16 Thread Dave Cragg


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

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "working" a web site from Rev

2005-08-16 Thread Ken Ray
On 8/16/05 4:48 PM, "Ken Ray" <[EMAIL PROTECTED]> wrote:

> put urlEncode("Test") into tName
> put urlEncode("test@test.com") into tEmail
> get url("http://www.123.com/cgi-bin/testcgi?"; & tName & "&" & tEmail)

Whoops! That should be:

  get url("http://www.123.com/cgi-bin/testcgi?name="; & tName & "&email="
  & tEmail)

Sorry...

But Dave's already clued you in on this, and his code is better than mine...
:-)


Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [EMAIL PROTECTED]


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "working" a web site from Rev

2005-08-18 Thread Jon

Dave:

Excellent help.

Question: how would one indicate that a check box field is checked (or not)?

Thanks!

Jon


Dave Cragg wrote:



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

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "working" a web site from Rev

2005-08-19 Thread Dave Cragg


On 18 Aug 2005, at 20:24, Jon wrote:


Dave:

Excellent help.

Question: how would one indicate that a check box field is checked  
(or not)?


Thanks!

Jon



I've never done this, but this is what I have read:

-- If the checkbox is unchecked, don't send anything.

-- If the checkbox is checked, send the "value" that is in the html.  
For example, if the form element is this (tag markers removed):


   input type="checkbox" name="hobby" value="fishing"

  you would send "hobby=fishing"

-- If no value is defined in the form, send "on" as the value.

-- Multiple checkboxes can have the same name, so if the checkbox  
form was like this:


   input type="checkbox" name="hobby" value="fishing"
   input type="checkbox" name="hobby" value="hunting"
   input type="checkbox" name="hobby" value="shooting"

  and the first two items were checked, you would send this:

   hobby=fishing&hobby=hunting

Cheers
Dave
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution