BOT Documentation

BOT commands summary

add add value to var
append add string to end of file
div div values to var
back go back n steps in browser
brain get,check, save and drop values in brain
breakpoint stop programm execution for single step execution and value inspection
call call subprogram
checkpause insert random break depending on time of day
click click element
close close close action
collect collect elements
compare goto label if comparison result is true
curl download a file with curl
date date functions
exit stop main program
extract_email extract email address from pagesource
extract_num extract numbers from string
extract_param extract param from url
fill fill form element
get get single value from webpage
get_location get location of browser, strip unused content in special cases
get_maincolor get main color of last screenshot
get_message get message to send to profile (generate "anrede")
get_record read record with id from database
goto goto label
json json encode tmparray
expect wait for element
label define label
length give length of string to var
let give variable a value
loop loop on content of array or file (creates automatically label loop_{loopname})
loopreset reset loop index to 0
message message send message to different targets
mkdir create directory
mult multiply value with var
open open URL
plz work through a list of PLZs
regex regex use regex on string save matches in var REGEX
replace replace string in other string
return return from calling aprogram or function
save_values save value from current page
screenshot take screenshot
search search element
select select item in selectbox
sendkey send special keyboard key
session save session variable
sleep pause number of seconds
split split string
strasse-nr split street in street + number
striptags remove html tags from string
sub subtract value from var
substr get substring of string
success count successful actions
switch2active switch context to active element
switch2iframe switch context to iframe
switchback switch contect back to default page
test several test commands (like shell test command)
tmparray temporary array for saving values added to other commands like save_values
trim trim a string (remove leading and trailing spaces) may be updated to general whitespace
update update database table
urldecode leave urldecoded value in var
urlencode leave urlencoded value in var
 

BOT commands

Usage

usage: /home/robo/bot [-a action_id [-b|-s]] | [-c] | [-t token]
-a action_id - set robot to work on
-b enables real run with selenium and startup of browser
-c show possible commands/tokens of "programming language"
-s do syntaxcheck of robot only (action must be defined to)
-t token - show help for specified token

add


Token add - add value to var

Parameters:

Parameter1 - Type: STRING Desc: varname
Parameter2 - Type: INTEGER Desc: value to add to var varname


append


Token append - add string to end of file

Parameters:

Parameter1 - Type: LABEL Desc: label to goto if command fails
Parameter2 - Type: STRING Desc: name of file to append text to
Parameter3 - Type: STRING Desc: string to append to file


div


Token div - div values to var

Parameters:

Parameter1 - Type: STRING Desc: varname
Parameter2 - Type: INTEGER Desc: divisor


back


Token back - go back n steps in browser

Parameters:

Parameter1 (optional) - Type: INTEGER Default: 1 Desc: count of steps to go back


brain


Token brain - get,check, save and drop values in brain

Parameters:

Parameter1 - Type: LABEL Desc: label to goto if command was successful
Parameter2 - Type: LIST Desc: action to be performed by brain function
allowed entries:
check
delete_all
get
put
drop

Parameter3 - Type: STRING Desc: id of action
Parameter4 - Type: STRING Desc: key for storing value
Parameter5 (optional) - Type: STRING Default: %NONE% Desc: value to store - get -> variable name to store value in
Parameter6 (optional) - Type: LIST Default: COUNTER Desc: value to store
allowed entries:
COUNTER
CHECK
LAST
SUCCESS
FAILURE
SKIP
TEMP


Examples:

brain loop_company check %CONF_AKTION_id% %VAR_loop_company_value%


breakpoint


Token breakpoint - stop programm execution for single step execution and value inspection

Examples:

breakpoint


call


Token call - call subprogram

Parameters:

Parameter1 - Type: LABEL Desc: label to goto if return value is okay
Parameter2 - Type: PROG Desc: Prog or function to call

Examples:

call label_name Xing-Login


checkpause

ERROR:/home/robo/bot:PROGRAMMING ERROR: token checkpause not documented for check_params() : line = checkpause; ABORT

click


Token click - click element

Parameters:

Parameter1 - Type: LABEL Desc: Label to jump to if click is successful
Parameter2 - Type: TARGET Desc: type of target (xpath|name|class) and corresponding search expression separated by %SEP%
Parameter3 (optional) - Type: STRING Desc: if set, do a sprintf with last parameter to obtain a xpath to click

Examples:

click label_end class|classname


close


Token close - close close action

Parameters:

Parameter1 - Type: STRING Desc: message to send on closing


collect


Token collect - collect elements

Parameters:

Parameter1 - Type: LABEL Desc: label to go to if collection was successful
Parameter2 - Type: STRING Desc: name of collection var
Parameter3 - Type: TARGET Desc: type of target and search expression (varnames in loop like %VAR_loop_companies_value% or next xpath %VAR_loop_companies1_value%
Parameter4 (optional) - Type: TARGET Desc: type of target and search expression (can be added mutliple times

Examples:

collect loop_company companies %CONF_unternehmenssuche_companies%


compare


Token compare - goto label if comparison result is true

Parameters:

Parameter1 - Type: LABEL Desc: label to go to if comparison delivers true
Parameter2 - Type: STRING Desc: first param for comparison
Parameter3 - Type: LIST Desc:
allowed entries:
==
!=
contains
is_empty
is_filled
>
>=
<
<=

Parameter4 (optional) - Type: STRING Desc: second param for comparison if needed


curl


Token curl - download a file with curl

Parameters:

Parameter1 - Type: LABEL Desc: label to jump to. if curl fails
Parameter2 - Type: URL Desc: source to downlaod in URL format
Parameter3 - Type: STRING Desc: target filename where download is stored


date


Token date - date functions

Parameters:

Parameter1 - Type: LIST Desc: reverse swaps date from i.e. 11.12.1959 to 1959-12-11
allowed entries:
reverse
now
sub
orig

Parameter2 - Type: STRING Desc: date to be converted
Parameter3 - Type: STRING Desc: variable name where result is left in $vars array


exit


Token exit - stop main program

Parameters:

Parameter1 - Type: BOOL Desc: return value, take screenshot if false


extract_email


Token extract_email - extract email address from pagesource

Parameters:

Parameter1 - Type: LABEL Desc: label to go to if email is found in string
Parameter2 - Type: STRING Desc: varname to store email in


extract_num


Token extract_num - extract numbers from string

Parameters:

Parameter1 - Type: STRING Desc: var to extract numbers from
Parameter2 - Type: STRING Desc: varname to store numbers in


extract_param


Token extract_param - extract param from url

Parameters:

Parameter1 - Type: STRING Desc: url to extract param from
Parameter2 - Type: STRING Desc: paramname we want to extract
Parameter3 - Type: STRING Desc: name of variable to store extracted value in


fill


Token fill - fill form element

Parameters:

Parameter1 - Type: LABEL Desc: label to go to if fill is successful
Parameter2 - Type: TARGET Desc: target of element
Parameter3 - Type: STRING Desc: value to fill in

Examples:

fill labelname xpath|xpath_value value


get


Token get - get single value from webpage

Parameters:

Parameter1 - Type: LABEL Desc: label to go to if failure
Parameter2 - Type: TARGET Desc: target of element to scrape value from
Parameter3 - Type: STRING Desc: varname to store value in


get_location


Token get_location - get location of browser, strip unused content in special cases

Parameters:

Parameter1 - Type: STRING Desc: varname to save location in
Parameter2 (optional) - Type: STRING Desc: mode - (raw) return complete url without processing


get_maincolor


Token get_maincolor - get main color of last screenshot

Parameters:

Parameter1 - Type: STRING Desc: varname to save color in


get_message


Token get_message - get message to send to profile (generate "anrede")

Parameters:

Parameter1 - Type: LABEL Desc: label to go to if message could be constructed
Parameter2 - Type: STRING Desc: ID of message in dbtable {prefix}_message or message
Parameter3 (optional) - Type: LIST Desc: if set then message is passed directly by robot and not via message_id
allowed entries:
messagepassed


Results:

leaves data in SESSION["SUBJECT"] and SESSION["MESSAGE"] for further use


get_record


Token get_record - read record with id from database

Parameters:

Parameter1 - Type: LABEL Desc: label to goto if reading record fails
Parameter2 - Type: STRING Desc: tablename (without prefix)
Parameter3 - Type: INTEGER Desc: id of record
Parameter4 - Type: STRING Desc: varname to store record data in (extended by _{fieldname} for each field)
Parameter5 (optional) - Type: STRING Desc: fieldname for lookup instead of "id"


goto


Token goto - goto label

Parameters:

Parameter1 - Type: LABEL Desc: label to go to


json


Token json - json encode tmparray

Parameters:

Parameter1 - Type: LABEL Desc: label to go to if error occurs
Parameter2 - Type: LIST Desc: action to be taken
allowed entries:
encode
encode_db
decode

Parameter3 - Type: STRING Desc: varname where result of json action is stored or string to decode
Parameter4 (optional) - Type: STRING Desc: if decode then array values like ("x"=>"y") ar saved to VAR_string_x with value "y"


expect


Token expect - wait for element

Parameters:

Parameter1 - Type: LABEL Desc: label to goto if expected element exists
Parameter2 - Type: TARGET Desc: type and value separated by %SEP% to wait for
Parameter3 (optional) - Type: INTEGER Default: 30 Desc: timeout


label


Token label - define label

Parameters:

Parameter1 - Type: STRING Desc: name of label (must not start with "loop_", which is reserved for automatically defined labels for loops)

Examples:

label labelname


length


Token length - give length of string to var

Parameters:

Parameter1 - Type: STRING Desc: varname to get length of
Parameter2 - Type: STRING Desc: varname to store length in


let


Token let - give variable a value

Parameters:

Parameter1 - Type: STRING Desc: varname
Parameter2 - Type: LIST Desc: separator to concatenate multiple words with
allowed entries:
%SPACE%
%NONE%
-
/

%SEP%
_

Parameter3 - Type: STRING Desc: value to be assigned to var varname


loop


Token loop - loop on content of array or file (creates automatically label loop_{loopname})

Parameters:

Parameter1 - Type: LABEL Desc: label to go to if loop is ended
Parameter2 - Type: STRING Desc: loop name
Parameter3 - Type: LIST Desc: type of source for loop
allowed entries:
db
file
collect
splitresult
sql

Parameter4 (optional) - Type: STRING Desc: if set and contains %loopname%, %loopname% will be replaced with loop value OR sql statement
Parameter5 (optional) - Type: STRING Desc: if type equals splitresult string to split
Parameter6 (optional) - Type: STRING Desc: if type equals splitresult string to split by

Examples:

loop labelname plz file plz3 %AKTION_searchurl%


loopreset


Token loopreset - reset loop index to 0

Parameters:

Parameter1 - Type: STRING Desc: loop name


message


Token message - message send message to different targets

Parameters:

Parameter1 - Type: INTEGER Desc: message id in robo_sys_message
Parameter2 - Type: LISTMULTI Desc: target to send to
multiple allowed entries:
customer
admin
param

Parameter3 - Type: STRING Desc: param1
Parameter4 - Type: STRING Desc: param2
Parameter5 - Type: STRING Desc: param3
Parameter6 - Type: STRING Desc: param4
Parameter7 - Type: STRING Desc: param5
Parameter8 (optional) - Type: STRING Desc: additional email


mkdir


Token mkdir - create directory

Parameters:

Parameter1 - Type: LABEL Desc: label to goto if creation failed
Parameter2 - Type: STRING Desc: name of directory to be created
Parameter3 (optional) - Type: LIST Desc: options for directory command
allowed entries:
recursive



mult


Token mult - multiply value with var

Parameters:

Parameter1 - Type: STRING Desc: varname
Parameter2 - Type: INTEGER Desc: value to multiply with


open


Token open - open URL

Parameters:

Parameter1 - Type: LABEL Desc: label to goto if open was successful
Parameter2 - Type: URL Desc: URL to open
Parameter3 (optional) - Type: STRING Desc: wait until string is contained in title


plz


Token plz - work through a list of PLZs

Parameters:

Parameter1 - Type: LIST Desc: type of action
allowed entries:
init
getende
getnext
rmdone

Parameter2 - Type: STRING Desc: (init) plz to start with (getnext) number of results of search (rmdone) plz to remove from list
Parameter3 (optional) - Type: STRING Desc: (init) filename to persist list of plzs in filesystem (getnext,rmdone) varname to store value in


regex


Token regex - regex use regex on string save matches in var REGEX

Parameters:

Parameter1 - Type: LABEL Desc: label to goto if regex does not match
Parameter2 - Type: STRING Desc: regular expression
Parameter3 - Type: STRING Desc: var to match regex with


replace


Token replace - replace string in other string

Parameters:

Parameter1 - Type: STRING Desc: value in which the text will be replaced
Parameter2 - Type: STRING Desc: search text
Parameter3 - Type: STRING Desc: replace text
Parameter4 - Type: STRING Desc: variable name in which the result will be stored

Examples:

replace %VAR_loop_remember2_value% https://www.xing.com %NONE% loop_remember2_value


return


Token return - return from calling aprogram or function

Parameters:

Parameter1 - Type: BOOL Desc: return value: true=no error occured or false=error occured

Examples:

return true


save_values


Token save_values - save value from current page

Parameters:

Parameter1 - Type: STRING Desc: lookup string for config variables
Parameter2 - Type: STRING Desc: key to map to UUID
Parameter3 - Type: LIST Desc: main key for source of data
allowed entries:
xing_company
xing_company_employees
xing_profile
xing_group
immosearch

Parameter4 (optional) - Type: LIST Desc: if set add contents of tmparray to values to save
allowed entries:
tmparray



screenshot


Token screenshot - take screenshot

Parameters:

Parameter1 (optional) - Type: SCREENSHOTTARGET Default: debug Desc: file where the screenshot is saved to (action specific - debug => debug_aktionid.png)



Token search - search element

Parameters:

Parameter1 - Type: LABEL Desc: label to go to if search is successful
Parameter2 - Type: LIST Desc: type of search
allowed entries:
text
xpath

Parameter3 - Type: STRING Desc: text or xpath to search for


select


Token select - select item in selectbox

Parameters:

Parameter1 - Type: LABEL Desc: label to go to if select is successful
Parameter2 - Type: TARGET Desc: find select box itself
Parameter3 - Type: LIST Desc: type by what the item should be selected
allowed entries:
option
text

Parameter4 - Type: STRING Desc: text or option by which the item should be selected


sendkey


Token sendkey - send special keyboard key

Parameters:

Parameter1 - Type: LIST Desc: key to send
allowed entries:
ARROW_UP
ARROW_DOWN
ARROW_LEFT
ARROW_RIGHT
PAGE_UP
PAGE_DOWN



session


Token session - save session variable

Parameters:

Parameter1 - Type: STRING Desc: variable name
Parameter2 - Type: STRING Desc: value


sleep


Token sleep - pause number of seconds

Parameters:

Parameter1 - Type: INTEGER Desc: seconds to sleep


split


Token split - split string

Parameters:

Parameter1 - Type: STRING Desc: string to be splitted
Parameter2 - Type: STRING Desc: string to split by

Examples:

split a;b;c ;


strasse-nr


Token strasse-nr - split street in street + number

Parameters:

Parameter1 - Type: STRING Desc: string to be splitted
Parameter2 - Type: STRING Desc: varname used as varname0=street varname1=number


striptags


Token striptags - remove html tags from string

Parameters:

Parameter1 - Type: STRING Desc: var with html tags
Parameter2 - Type: STRING Desc: varname to store new value in


sub


Token sub - subtract value from var

Parameters:

Parameter1 - Type: STRING Desc: varname
Parameter2 - Type: INTEGER Desc: value to substract


substr


Token substr - get substring of string

Parameters:

Parameter1 - Type: STRING Desc: value to take substr from
Parameter2 - Type: INTEGER Desc: startposition of substring
Parameter3 - Type: INTEGER Desc: length of substring
Parameter4 - Type: STRING Desc: varname to save result


success


Token success - count successful actions

Parameters:

Parameter1 - Type: LABEL Desc: label to go to if limit not reached
Parameter2 - Type: LIST Desc:
allowed entries:
daily


Examples:

success daily


switch2active


Token switch2active - switch context to active element

Parameters:

Parameter1 - Type: LABEL Desc: label to goto if switch fails


switch2iframe


Token switch2iframe - switch context to iframe

Parameters:

Parameter1 - Type: LABEL Desc: label to goto if test fails
Parameter2 - Type: TARGET Desc: searchstring (xpath etc.) for iframe


switchback


Token switchback - switch contect back to default page

Parameters:

Parameter1 - Type: LABEL Desc: label to goto if switch fails


test


Token test - several test commands (like shell test command)

Parameters:

Parameter1 - Type: LABEL Desc: label to goto if test fails
Parameter2 - Type: LIST Desc: what to test
allowed entries:
dir
tries

Parameter3 - Type: STRING Desc: parameter dependent of kind of test (dir -> directory name,tries -> key)
Parameter4 (optional) - Type: INTEGER Desc: (tries-> max tries)


tmparray


Token tmparray - temporary array for saving values added to other commands like save_values

Parameters:

Parameter1 - Type: LIST Desc: type of action
allowed entries:
clear
add
syncdb

Parameter2 (optional) - Type: STRING Desc: (add) name of array key (syncdb) bezeichnung of webwatch
Parameter3 (optional) - Type: STRING Desc: (add)value of array key (syncdb) id of webwatch


trim


Token trim - trim a string (remove leading and trailing spaces) - may be updated to general whitespace

Parameters:

Parameter1 - Type: STRING Desc: var to be trimmed
Parameter2 - Type: STRING Desc: varname to store trimmed value in


update


Token update - update database table

Parameters:

Parameter1 - Type: LIST Desc: name of table
allowed entries:
account
aktion
data
execute
proxy
sys_person

Parameter2 - Type: LIST Desc: name of tablefield
allowed entries:
back_to
bearbeitet
bezeichnung
data
status
error
xing_account_type

Parameter3 - Type: STRING Desc: new value of tablefield


urldecode


Token urldecode - leave urldecoded value in var

Parameters:

Parameter1 - Type: STRING Desc: var to be urldecoded
Parameter2 - Type: STRING Desc: varname of result


urlencode


Token urlencode - leave urlencoded value in var

Parameters:

Parameter1 - Type: STRING Desc: var to be urlencoded
Parameter2 - Type: STRING Desc: varname of result