Information may be Out-of-Date


This page about deprecated software versions is shown for
reference purposes only. Information on this page is not
maintained and may no longer be valid.
 

Please find the latest manual for Webserver Stress Tool here:

Manual Webserver Stress Tool (pdf)
 

Navigation: Contents   Index   Previous   Next

Reading a TOKEN from a page and reusing it on subsequent requests

The following script shows how to read some data from the HTML of a page and the use this data in subsequent requests:

' =================================================================

' Webserver Stress Tool V7 *** Sample Script for Reusing a Token

' =================================================================

' Requires Webserver Stress Tool 7.0.2 or later

 

Sub OnBeforeClick

 

   if data.clickcount=0 then data.url="http://walldorf.paessler.com" end if

   if data.clickcount=1 then data.url="http://walldorf.paessler.com/?test="+data.token end if

   data.log="Preparing click #"+inttostr(data.clickcount+1)+" of user #"+inttostr(data.usernumber+1)

 

end Sub

 

Sub OnAfterClick

  data.log=""

end sub

 

Sub OnbeforeRequest

  data.log=""

end sub

 

 

Sub OnAfterRequest

 

  if data.clickcount=0 then 'we only look in the HTML of the first click for our tags

    if data.requestcount=0 then 'we only look in the HTML of the first request of the first click for our tags

 

      tagbefore="<title>"

      tagafter="</title>"   'our tag/token delimiters

 

      if pos(tagbefore,request.html)>0 then

        if pos(tagafter,request.html)>0 then

          tagbegin=pos(tagbefore,request.html)+length(tagbefore)

          taglength=pos(tagafter,request.html)-tagbegin

          mytag=copy(request.html,tagbegin,taglength)

          data.log="FOUND TOKEN: '"+mytag+"'"

          data.token=mytag

        else

          data.log="Closing Token not found ("+tagafter+") in request number "+inttostr(data.requestcount)+" with resultcode "+inttostr(request.resultcode)+" ("+request.result+")"

        end if             

      else

        data.log="Opening Token not found ("+tagbefore+") in request number "+inttostr(data.requestcount)+" with resultcode "+inttostr(request.resultcode)+" ("+request.result+")"

      end if

 

    end if

  end if

 

end sub

Navigation: Contents   Index   Previous   Next

This third party content uses Performance cookies. Change your Cookie Settings or

load anyways

*This will leave your Cookie Settings unchanged.