Runtime Entities

Static Variables

Static variables are variables that are set by the system in a certain context and typically contain values of certain environment parameters in this context. Static variables, like arguments, can be used only for reading, you can not set or change them. Also, static variables can not be used in data substitution, in contrast to variables and arguments.

Static variables created in a specific context are available in all valid contexts, and also are context-dependent.

The following static variables are currently available:

Variable Description Context
lastUrl URL of last loaded page All
url URL of current page Page, Block, Form

Despite the fact that static variables are available in practically all contexts, you can use them only in a block context, because the register exists only in a block context and the only command for static variables works with the register.

Below is an example of using a static variable url:

          ---
config:
    agent: Chrome
do:
- walk:
    to: http://www.somesite.com
    do:
    - find:
        path: body
        do:
        - static_get: url
        - variable_set: page_url # now we have value http://www.somesite.com in the variable with name `page_url`