____________________________________________________ WEBCLIENT USAGE ____________________________________________________ java -jar WebLoader.jar CommandFile [NOSSL] [VarKey1=VarValue1] ... [VarKeyX=VarValueY] Syntax of CommandFile(.net) using Web-Command-Language(WCL): [PARAMETER1] [PARAMETER2] .. e.g.: PRINT "Current SessionID is: $SESSIONID$!" -- COMMON COMMANDS: CLEAR [COOKIES] Removes/Clears all variables and cookies stored. When passing "COOKIES" all known cookies would be cleared only. GOTOIFVARCONTAINS/GIVC/GOTO [Var_RT] Performs goto (endless==while) if given value is contained in Variable or current Content ($RET$) If taskname is unknown the command will be simply ignored/skipped. Thereby a type of if-then-else can be imitated by chaining GOTO-Commands. *Example: GIVC [END $RET$ "Data submitted successfully" GIVC END $RET$ $MESSAGE$ GIVC END "Data submitted" GOTO [] Enables loops by jumping to task (optional given number of times, default is endless: ~) If Counter is exhausted(<=0) or taskname is unknown the command will be simply ignored/skipped. Thereby a type of if-then-else can be imitated by chaining GOTO-Commands. *Examples: GOTO $SUCCESS_TASKNAME$ 10 GOTO [TASKNAME GOTO TASKNAME ~ INCR/DECR Increments/Decrements value stored in variable *Examples: INCR $COUNTER$ DECR $LOOP_INDEX$ PRINT Prints Text to console *Example: PRINT "This is SID-Value: $SID$" PRINT GET [index_NUMBER{DEF=0,LAST=-1}] Prints (left aligned) enclosed Text to console *Example: PRINT GET "href=""" """" PRINT GETR Prints (right aligned) enclosed Text to console *Example: PRINT GETR "href=""" """>Link" PRINT COOKIE [Key_TEXT] [Url_TEXT] Prints Cookie-content to console. Cookies of last used URL would be recognized here when not mentioned explicitly *Example: PRINT COOKIE SID PRINT " GET" Prints RT followed by enclosed Text to console *Example: PRINT "This is a link: GET" "href=""" """" PRINTRESULT/PRINT Prints current body-content to console *Example: PRINTRESULT PACKRESULT Packs current body-content (Remove Linebreaks and Tabs) *Example: PACKRESULT SYNC Synchronising by waiting for all threads (if any) to be reached here before going ahead *Example: SYNC UPCASERESULT Upcases current body-content *Example: UPCASERESULT WRITE [Data_RT] If no RT is passed last data received/returned (==BODY) would be written in file Otherwise dedicated data will be written to passed file *Examples: WRITE out_$DEV$.txt "This is SID-Value: $SID$" WRITE "last_data_received.txt" WAIT/SLEEP Waits number of milliseconds *Examples: WAIT 1000 SLEEP 1000 WAITR/SLEEPR Waits random number of max milliseconds *Example: WAITR 1000 WAITG/SLEEPG Waits pseudorandom, Gaussian ("normally") number of max milliseconds *Example: WAITG 1000 -- NET COMMANDS: FOLLOW [RP] Requests given page and follows redirects using location property step-by-step -> Detailed Log *Example: FOLLOWREDIR http://www.heise.de/suche/ q=test&search_submit=Suche&rm=search "x-microsoftajax#Delta=true" FOLLOWREDIR http://www.heise.de/suche/ "" "x-microsoftajax#Delta=true" FOLLOWREDIR [RP] Requests given page and hiddenly follows redirects using location property -> No detailed Log *Example: FOLLOWREDIR http://www.heise.de/suche/ q=test&search_submit=Suche&rm=search "x-microsoftajax#Delta=true" READ [RP] Requests given page only *Example: READ http://www.heise.de/suche/ q=test&search_submit=Suche&rm=search "x-microsoftajax#Delta=true" -- CONFIG COMMANDS: SET EXTENSION Sets class extending commandset. The class needs to implement CommandprocessorInterface having default constructor. *Example: SET EXTENSION example.myProcessor SET AGENT Sets Agent used in request *Example: SET AGENT "Mozilla 3.5 (Unix 123)" SET COOKIETRACE Sets Cookietrace on/off(default) *Example: SET COOKIETRACE TRUE SET LOGFILE [CsvSeparatorCharacter] Sets and enables logfile Default Csv-Separator is ';' - This constant is shared across Logger and Tracker *Examples: SET LOGFILE log.txt SET LOGFILE logCommata.txt , SET MODE [Filename_TEXT] [CsvSeparatorCharacter] Sets Tracking mode and optional outputfile 0 = no tracking (Default) 1 = Tracking (Redirects are getting aggregated) 2 = Detailed tracking (Redirects are tracked in detail if 'FOLLOW'-Command is used -> See 'NET COMMANDS') Default Csv-Separator is ';' - This constant is shared across Logger and Tracker *Examples: SET MODE 2 ./tracker.csv SET MODE 2 ./trackerCommata.csv , SET NWTRACE Sets Networktrace on/off(default) *Example: SET NWTRACE TRUE SET PROXY user:pass@host:port||null Sets and enables proxy *Examples: -Enabling Proxy SET PROXY me:mypass@myproxy:port SET PROXY user\domain:pass@host:80/excludehost|excludeanotherhost -Disabling Proxy SET PROXY NO SET PROXY SET TIMEOUT Sets ConnectTimeout & ReadTimeout (Default is 60000 [ms] = 1 Min) *Example: SET TIMEOUT 120000 SET TRACE Sets Trace on/off(default) *Example: SET TRACE TRUE -- UTIL COMMANDS: EXIT/QUIT Exits/Quits the current runnung (root-)script *Examples QUIT EXIT EXT [Parameter1_Text] [Parameter2_Text] ... [ParameterX_Text] Uses extension class and redirects line having command to. *Example EXT Test Parameter1 INCLUDE Includes (embeddes) another commandfile using lazy-load on demand in current context *Example: INCLUDE include.net RUN/CALL/START Runs another commandfile in separated context. Current Variables get defensively cloned and transferred in new context but not reverse ! *Example: RUN anotherJob.net SET GETXPATH [Var_RT] Stores value of given XPath performed on Value of Variable or current Content ($RET$) *Example: SET $SECONDLINK$ GETXPATH /html/body/table/tbody/tr[2]/td[4] $RET$ SET GETREGEX [index_NUMBER{DEF=0,LAST=-1}] Stores regex match of text in Variable performed on Value of Variable *Example: SET $SECONDLINK$ GETREGEX "\\d*a\\d*" $RET$ 1 SET GET [index_NUMBER{DEF=0,LAST=-1}] Stores (left aligned) enclosed Text in Variable *Example: SET $SECONDLINK$ GET "href=""" """" 1 SET GETR Stores (right aligned) enclosed Text in Variable *Example: SET $THELINK$ GETR "href=""" """>Link" SET GETNOTNULL Stores enclosed Text in Variable if exists (Not null) *Example: SET $SECONDLINK$ GETNOTNULL "href=""" """" 1 SET COOKIE [Url_TEXT] Stores Cookie-content in Variable. Cookies of last used URL would be recognized here when not mentioned explicitly *Example: SET $SID$ COOKIE SID SET $SID$ COOKIE SID http://www.google.de SET HEADER Stores Header-content in Variable *Examples: SET $SID$ HEADER Content-Type SET $RES_CODE$ $RC$ SET ASK Stores Console-Input in Variable *Example: SET $MANUALSID$ ASK "Please provide SID for User $USER$:" SET TRIM Stores trimed Text in Variable *Example: SET $MANUALSID$ TRIM " spacesAround " SET REPLACE Replaces Text inside a Variable *Example: SET $SID$ REPLACE "thisUser" "thatUser" SET Stores Text in Variable *Example: SET $USERNAME$ "MyUserName" SET ENC Encodes Text and store it in Variable *Example: SET $USERNAME$ ENC "MyPass HasSpaces" SET DEC Decodes Text and store it in Variable *Example: SET $USERNAME$ DEC "MyPass%20NeedsSpaces" SET COOKIE [Url_TEXT] Sets Cookie. Cookies of last used URL would be recognized here when not mentioned explicitly *Examples: -Removes Cookie SID SET COOKIE SID -Adds Cookie SID SET COOKIE SID "MySessionID" -- MARKER: # = Inline comment [ = Task containing commands (end of one task is determinated by new task started -> no hierarchie !) *[ = Disabled Task: All commands belonging to this task (till next Task-Mark) will be skipped! -- PLACEHOLDER prefixed by underscore '_' or embraced by '< >' are mandatory; those in '[ ]' are optional: NUMBER = Number *Example: 123 URL = *Example: $Host$/index.html FLAG = true or false VARIABLE = $(A-Z0-9_)$ *Predefined(!): - $RET$ for last data received/returned (==BODY) - $RC$ Responsecode from headerfields (Default: -1) - $RM$ Responsemessage from headerfields supplemented with IOException if occurred - $DATE$ Current date in format yyyy-MM-dd - $TIME$ Current time in format yyyy-MM-dd_HHmmss *Example: $SESSIONID1$ TEXT = Any Text (quotes being escaped by an additional quote) *Example: "This is a quote: "" !" RT = Resolveable-Text = Text may containing Variables that gets resolved recurively (max: 10 loops!) *Example: "My Sid is: $SID$" RP = Request-Properties . Syntax: #[|][RP] *Example: x-microsoftajax#Delta=true|Referer#http://localhost Please Note: -> Values including spaces have to be encapsulated by quotes("). *Example: "Here are spaces" -> Quotes(") have to be escaped by appending another quote! *Example: "This is a quote: "" !" *Example: """"