Web Forms Section

Web forms are the most important interface to exchange data with the Web server. The forms section can easily be randomized and is used by WebForm functions.

The Web forms used by the transactions are defined using the keyword dclform.

The following simple example shows a portion of a Silk Performer program for simulating a form submission. Random variables rsEmail and rsPlatform (RndFile and RndInd) are defined in the random variables section using two different random functions. With each subsequent call to WebFormPost and WebFormGet, the random variables are refreshed and so contain new random values. These random values are used to generate the URL-encoded form string that is automatically sent within the request to the Web server. WebFormPost adds the form content string at the end of the HTTP header, while WebFormGet adds the form content string at the end of the URL separated by an "?".

Example

dclrand
  rsEmail    : RndFile("elname.rnd", 20);
  rsPlatform : RndInd("Windows NT" = 0.4;
                      "Windows 95" = 0.2
                      "Unix"       = 0.3;
                      "other"      = 0.1);

dcltrans
  transaction TWebFormPost
  begin
    WebFormPost("http://www.comp.com/cgi/FormMail.pl",
                CGI_CUST_SUPPORT);
    WebFormGet("http://www.comp.com/cgi/form",
                CGI_CUST_SUPPORT);
    WebThreadWait(WAIT_FORALLTHREADS);
  end TWebFormPost;

dclform
  CGI_CUST_SUPPORT:
    "email"     := rsEmail,
    "sitetype"  := "business",
    "sitelang1" := "english",
    "sitelang2" := "",
    "platform"  := rsPlatform;