Runtime Entities
Arguments
Arguments, same as variables, are very widely used to substitute data, and can be used in the same cases, as variables.
The main differences from the variables:
- Arguments are static data set by the iterator on a specific step of iteration loop
- Arguments exist in all contexts and are context-independent
- Arguments values can not be changed, but you can use them for substitution and read their values to the register
Below are examples of using arguments in different situations:
# USING ARGUMENTS `start_date` AND `end_date` OF DATES ITERATOR WHEN WE ARE LOADING SPECIFIC PAGE
- walk:
to: 'http://www.somesite.com/?getDataFrom=<%start_date%>&to=<%end_date%>'
do:
# USING ARGUMENT `age` OF CSV/FIELDSET ITERATOR IN THE COMMAND FOR ADDING LINK TO THE POOL
- link_add:
url: 'http://www.somesite.com/?getDataFromAge=<%age%>'
# USING ARGUMENT `date` IN THE COMMAND FOR FINDING ELEMENTS USING CSS-PATH
- find:
path: '.vetrina > tbody > tr:has(td:nth-of-type(4):matches(<%date%>))'
do:
# USING ARGUMENTS `start_date` AND `end_date` OF DATES ITERATOR IN POST REQUEST
- walk:
to:
post: http://www.somesite.com
data:
getDataFrom: <%start_date%>
to: <%end_date%>
do:
# USING ARGUMENT`age` OF CSV/FIELDSET ITERATOR IN A FORM
- find:
form: main
do:
- fields_set:
age: <%age%>
- submit
# USING ARGUMENT `age` HEN POPULATING THE REGISTER
- register_set: Jane is <%age%> years old
# USING ARGUMENT `total` WHEN EXECUTING JS SNIPPET
- eval:
routine: js
body: '(function() {
var t = <%total%>;
var offset = [];
for(var i = 1; (i-1)*26 < t; i++) {
offset.push(i);
}
return offset.join(",");
})();'
We will learn more about arguments usage in the corresponding section.