You may be able to do that using the STAF HTTP service.  The HTTP service 
is the only method that STAF provides to submit HTTP requests to web 
pages.  See "Appendix A: Form Control Guide" in the STAF HTTP Service 
User's Guide at 
http://staf.sourceforge.net/current/Http.html#Form%20Controls provides 
information about interacting with the specific form control types on web 
pages using the HTTP service.

Here is an example that uses a test web page to demonstrate how you can 
work with forms using the STAF HTTP service.

1.      Open a new session: 

C:\>STAF local HTTP OPEN SESSION
Response
--------
1

2.      Go the the testHTTP.html webpage: 
C:\>STAF local HTTP DOGET URL http://mywebsite.com/content/testHTTP.html 
RETURNNOCONTENT SESSION 1 
Response
--------
Status Code   : 200
Status Message: OK
Headers       : <None>
Content       : <None>

3.      List the forms available on the page: 

C:\>STAF local HTTP LIST FORMS SESSION 1
Response
--------
Index Form ID     Form Name
----- ----------- -------------
1     GET_FORM    The Get Form
2     POST_FORM   The Post Form
3     POST_FORM_2 <None>

4.      Query the first form. This should be GET_FORM with an empty submit 
and one input parameter named town: 

C:\>STAF local HTTP QUERY FORM SESSION 1
Response
--------
Index    : 1
Form ID  : GET_FORM
Form Name: The Get Form
Method   : Get
Action   : http://www.htmlcodetutorial.com/cgi-bin/mycgi.pl
Headers  : <None>


C:\>STAF local HTTP LIST FORM CONTROLNAMES SESSION 1
Response
--------
submit
town


C:\>STAF local HTTP QUERY FORM CONTROLNAME submit SESSION 1
Response
--------
{
  Type           : Submit group
  Disabled       : No
  Read Only      : No
  Value          : =Submit Query
  Possible Values: [
    =Submit Query
  ]
}

C:\>STAF local HTTP QUERY FORM CONTROLNAME town SESSION 1
Response
--------
Type           : input type=text
Disabled       : No
Read Only      : No
Value          : <None>
Possible Values: <None>

5.      Query form POST_FORM_2 (the third form): 
This form should have 2 radio inputs, animal and color, 2 hidden inputs, 2 
select inputs, one multivalue and one single value, and submit, which has 
3 buttons and one image to select from. 
C:\>STAF local HTTP QUERY FORM ID POST_FORM_2 SESSION 1
Response
--------
Index    : 3
Form ID  : POST_FORM_2
Form Name: <None>
Method   : Post
Action   : http://www.htmlcodetutorial.com/cgi-bin/mycgi.pl
Headers  : <None>


C:\>STAF local HTTP LIST FORM INDEX 3 CONTROLNAMES SESSION 1
Response
--------
submit
color
animal
invis1
invis2
who
who1
<None>

6.      Change the radio control animal to cat: 
C:\>STAF local HTTP QUERY FORM INDEX 3 CONTROLNAME animal SESSION 1
Response
--------
{
  Type           : input type=radio
  Disabled       : No
  Read Only      : No
  Value          : dog
  Possible Values: [
    cat
    bird
  ]
}


C:\>STAF local HTTP SET FORM INDEX 3 SESSION 1 CONTROLNAME animal VALUE 
cat
Response
--------


C:\>STAF local HTTP QUERY FORM INDEX 3 CONTROLNAME animal SESSION 1
Response
--------
{
  Type           : input type=radio
  Disabled       : No
  Read Only      : No
  Value          : cat
  Possible Values: [
    dog
    bird
  ]
}

7.      Change the radio control animal to bird: 

C:\>STAF local HTTP SET FORM INDEX 3 SESSION 1 CONTROLNAME animal VALUE 
bird
Response
--------


C:\>STAF local HTTP QUERY FORM INDEX 3 CONTROLNAME animal SESSION 1
Response
--------
{
  Type           : input type=radio
  Disabled       : No
  Read Only      : No
  Value          : bird
  Possible Values: [
    cat
    dog
  ]
}

8.      Set the radio control color to blue: 

C:\>STAF local HTTP QUERY FORM INDEX 3 CONTROLNAME color SESSION 1
Response
--------
{
  Type           : input type=radio
  Disabled       : <None>
  Read Only      : <None>
  Value          : <None>
  Possible Values: [
    red
    blue
    green
    yellow
  ]
}


C:\>STAF local HTTP SET FORM INDEX 3 SESSION 1 CONTROLNAME color VALUE 
blue
Response
--------


C:\>STAF local HTTP QUERY FORM INDEX 3 CONTROLNAME color SESSION 1
Response
--------
{
  Type           : input type=radio
  Disabled       : No
  Read Only      : No
  Value          : blue
  Possible Values: [
    red
    green
    yellow
  ]
}

9.      Set the select control who to foo: 

C:\>STAF local HTTP QUERY FORM INDEX 3 CONTROLNAME who SESSION 1
Response
--------
{
  Type           : select
  Disabled       : No
  Read Only      : No
  Value          : <None>
  Possible Values: [
    foo
    sam
  ]
}


C:\>STAF local HTTP SET FORM INDEX 3 SESSION 1 CONTROLNAME who VALUE foo
Response
--------


C:\>STAF local HTTP QUERY FORM INDEX 3 CONTROLNAME who SESSION 1
Response
--------
{
  Type           : select
  Disabled       : No
  Read Only      : No
  Value          : foo
  Possible Values: [
    sam
  ]
}

10.     Change the select control who to sam. Note that you must first 
de-select foo before setting a new value for the form control named who. 

C:\>STAF local HTTP SET FORM INDEX 3 SESSION 1 CONTROLNAME who VALUE sam
Error submitting request, RC: 47
Additional info
---------------
Invalid parameter value sam. Deselect foo before setting a new value


C:\>STAF local HTTP SET FORM INDEX 3 SESSION 1 CONTROLNAME who VALUE foo
Response
--------


C:\>STAF local HTTP SET FORM INDEX 3 SESSION 1 CONTROLNAME who VALUE sam
Response
--------


C:\>STAF local HTTP QUERY FORM INDEX 3 CONTROLNAME who SESSION 1
Response
--------
{
  Type           : select
  Disabled       : No
  Read Only      : No
  Value          : sam
  Possible Values: [
    foo
  ]
}

11.     Set the multi value select control to foo and sam: 

C:\>STAF local HTTP QUERY FORM INDEX 3 CONTROLNAME who1 SESSION 1
Response
--------
{
  Type           : select multiple
  Disabled       : No
  Read Only      : No
  Value          : <None>
  Possible Values: [
    foo
    sam
  ]
}


C:\>STAF local HTTP SET FORM INDEX 3 SESSION 1 CONTROLNAME who1 VALUE foo
Response
--------


C:\>STAF local HTTP SET FORM INDEX 3 SESSION 1 CONTROLNAME who1 VALUE sam
Response
--------


C:\>STAF local HTTP QUERY FORM INDEX 3 CONTROLNAME who1 SESSION 1
Response
--------
{
  Type           : select multiple
  Disabled       : No
  Read Only      : No
  Value          : foo
sam
  Possible Values: []
}

12.     Change the submit control to the image pic with submit coordinates 
1,1. The control named pic has no value attribute. 

C:\>STAF local HTTP QUERY FORM INDEX 3 CONTROLNAME submit SESSION 1
Response
--------
{
  Type           : Submit group
  Disabled       : No
  Read Only      : No
  Value          : GO=go
  Possible Values: [
    GO=go
    Stay=stay
    roll over=Roll Over
    pic=,<valueX>,<valueY>
  ]
}

C:\>STAF local HTTP SET FORM INDEX 3 SESSION 1 CONTROLNAME submit VALUE 
pic=,1,1

Response
--------


C:\>STAF local HTTP QUERY FORM INDEX 3 CONTROLNAME submit SESSION 1
Response
--------
{
  Type           : Submit group
  Disabled       : No
  Read Only      : No
  Value          : pic=,1,1
  Possible Values: [
    GO=go
    Stay=stay
    roll over=Roll Over
    pic=,<valueX>,<valueY>
  ]
}

13.     Change the submit control to the button named Stay: 

C:\>STAF local HTTP SET FORM INDEX 3 SESSION 1 CONTROLNAME submit VALUE 
Stay=stay
Response
--------


C:\>STAF local HTTP QUERY FORM INDEX 3 CONTROLNAME submit SESSION 1
Response
--------
{
  Type           : Submit group
  Disabled       : No
  Read Only      : No
  Value          : Stay=stay
  Possible Values: [
    GO=go
    Stay=stay
    roll over=Roll Over
    pic=,<valueX>,<valueY>
  ]
}

14.     Reset the form and show the default values. Note the value of the 
submit control has not changed. 

C:\>STAF local HTTP RESET FORM INDEX 3 SESSION 1
Response
--------


C:\>STAF local HTTP QUERY FORM INDEX 3 SESSION 1
Response
--------
Index    : 3
Form ID  : POST_FORM_2
Form Name: <None>
Method   : Post
Action   : http://www.htmlcodetutorial.com/cgi-bin/mycgi.pl
Headers  : <None>


C:\>STAF local HTTP QUERY FORM INDEX 3 CONTROLNAME submit SESSION 1
Response
--------
{
  Type           : Submit group
  Disabled       : No
  Read Only      : No
  Value          : Stay=stay
  Possible Values: [
    GO=go
    Stay=stay
    roll over=Roll Over
    pic=,<valueX>,<valueY>
  ]
}


C:\>STAF local HTTP QUERY FORM INDEX 3 CONTROLNAME animal SESSION 1
Response
--------
{
  Type           : input type=radio
  Disabled       : No
  Read Only      : No
  Value          : dog
  Possible Values: [
    cat
    bird
  ]
}


C:\>STAF local HTTP QUERY FORM INDEX 3 CONTROLNAME who SESSION 1
Response
--------
{
  Type           : select
  Disabled       : No
  Read Only      : No
  Value          : <None>
  Possible Values: [
    foo
    sam
  ]
}


C:\>STAF local HTTP QUERY FORM INDEX 3 CONTROLNAME who1 SESSION 1
Response
--------
{
  Type           : select multiple
  Disabled       : No
  Read Only      : No
  Value          : <None>
  Possible Values: [
    foo
    sam
  ]
}

15.     Set a pair of checkboxes (nosmoke and dogs) on the second form: 

C:\>STAF local HTTP QUERY FORM INDEX 2 SESSION 1
Response
--------
Index    : 2
Form ID  : POST_FORM
Form Name: The Post Form
Method   : Post
Action   : http://www.htmlcodetutorial.com/cgi-bin/mycgi.pl
Headers  : <None>


C:\>STAF local HTTP LIST FORM INDEX 2 CONTROLNAMES SESSION 1
Response
--------
submit
realname
email
nosmoke=
hatesanchovies=
shakespeare=
washesdaily=
beach=
brooklyn=
dogs=
cats=
iguanas=
myself


C:\>STAF local HTTP SET FORM INDEX 2 CONTROLNAME nosmoke= VALUE checked 
SESSION
1
Response
--------


C:\>STAF local HTTP SET FORM INDEX 2 CONTROLNAME dogs= VALUE checked 
SESSION 1
Response
--------


C:\>STAF local HTTP QUERY FORM INDEX 2 CONTROLNAME nosmoke= SESSION 1
Response
--------
Type           : input type=checkbox
Disabled       : No
Read Only      : No
Value          : CHECKED
Possible Values: <None>

C:\>STAF local HTTP QUERY FORM INDEX 2 CONTROLNAME dogs= SESSION 1
Response
--------
Type           : input type=checkbox
Disabled       : No
Read Only      : No
Value          : CHECKED
Possible Values: <None>

16.     Submit the last form with default values: 

C:\>STAF local HTTP SUBMIT FORM INDEX 3 RETURNNOCONTENT SESSION 1
Response
--------
Status Code   : 200
Status Message: OK
Headers       : <None>
Content       : <None>

17.     Close the session: 

C:\>STAF local HTTP CLOSE SESSION 1
Response
--------



--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




From:   "Padalia, Preeti" <preeti.pada...@fisglobal.com>
To:     "staf-users@lists.sourceforge.net" 
<'staf-users@lists.sourceforge.net'>
Cc:     "luc...@us.ibm.com" <'luc...@us.ibm.com'>
Date:   05/18/2011 04:40 AM
Subject:        [staf-users] (no subject)



Hi,
 
I have to do this tast. Post some data by http post. And then again have 
to  get those data. For example have to post my registration details. And 
the by my name I have to get my details. And in these operations I have to 
verify that the data got same as the posted data.
 
Does http provide any option for this.
And what are other ways to do this using staf.
 
Thanks in advance
preeti
 
From: Padalia, Preeti 
Sent: Wednesday, May 18, 2011 1:08 PM
To: 'staf-users@lists.sourceforge.net'
Cc: 'luc...@us.ibm.com'
Subject: RE: [staf-users] (no subject)
 
Thanks for these useful links. 
 
May be it will be another out of scope question but please tell me if we 
can read the html table just like those input types using http.
 
Thanks in advance.
 
 
 
From: Sharon Lucas [mailto:luc...@us.ibm.com] 
Sent: Monday, May 16, 2011 8:06 PM
To: Padalia, Preeti
Cc: staf-users@lists.sourceforge.net
Subject: RE: [staf-users] (no subject)
 
I don't think you understand what the STAF HTTP service does. The STAF 
HTTP service submits HTTP requests as if it is a web browser and can 
simulate a web browser session.  It uses HttpClient APIs (
http://hc.apache.org/httpcomponents-client-ga/) to do this. 

For more information on the HTTP service, see the HTTP Service User's 
Guide at http://staf.sourceforge.net/current/Http.html.  See section 
"Session Examples" for examples of using how the session functionality of 
the HTTP service can be leveraged. 

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




From:        "Padalia, Preeti" <preeti.pada...@fisglobal.com> 
To:        Sharon Lucas/Austin/IBM@IBMUS 
Cc:        <staf-users@lists.sourceforge.net> 
Date:        05/16/2011 07:44 AM 
Subject:        RE: [staf-users] (no subject) 




Thanks for the reply. 
  
But I am trying to execute an http request using http service which will 
open in web browser. Can these two actions can be execute in a single 
request. 
  
If so please tell me how. 
  
Any help will be appreciable; 
  
Thanks and regards 
Preeti 
  
From: Sharon Lucas [mailto:luc...@us.ibm.com] 
Sent: Friday, May 13, 2011 9:05 PM
To: Padalia, Preeti
Cc: staf-users@lists.sourceforge.net
Subject: Re: [staf-users] (no subject) 
  
You could use the STAF Process service to submit a START request to launch 
a web browser on a local or remote machine that is running STAF. 

However, note that the STAF HTTP service does not require a web browser to 
be launched, so I'm not sure why you are asking this.

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




From:        "Padalia, Preeti" <preeti.pada...@fisglobal.com> 
To:        <staf-users@lists.sourceforge.net> 
Date:        05/13/2011 12:36 AM 
Subject:        [staf-users] (no subject) 
 





I am new to staf. I want to know that is it possible that using staf we 
can launch the browser with url with http request . so that we can use the 
features of http service. 
 
 
Any help will be appreciable. 
 
Thanks and regards 
_____________

The information contained in this message is proprietary and/or 
confidential. If you are not the intended recipient, please: (i) delete 
the message and all copies; (ii) do not disclose, distribute or use the 
message in any manner; and (iii) notify the sender immediately. In 
addition, please be aware that any message addressed to our domain is 
subject to archiving and review by persons other than the intended 
recipient. Thank you.
_____________
------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users 
_____________

The information contained in this message is proprietary and/or 
confidential. If you are not the intended recipient, please: (i) delete 
the message and all copies; (ii) do not disclose, distribute or use the 
message in any manner; and (iii) notify the sender immediately. In 
addition, please be aware that any message addressed to our domain is 
subject to archiving and review by persons other than the intended 
recipient. Thank you.
_____________ 
_____________

The information contained in this message is proprietary and/or 
confidential. If you are not the intended recipient, please: (i) delete 
the message and all copies; (ii) do not disclose, distribute or use the 
message in any manner; and (iii) notify the sender immediately. In 
addition, please be aware that any message addressed to our domain is 
subject to archiving and review by persons other than the intended 
recipient. Thank you.
_____________
------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to