Static variables are set by the digger automatically in a specific context and are available in this and nested contexts. Currently, the following static variables are supported:
|url||page||Contains the URL of the current page.|
|lastUrl||page||Contains the URL of the last page loaded.|
Since all available commands for working with static variables also work with the register, you can use them only in a block context:
# SWITCHING TO THE BLOCK - find: path: .somepath do: # READING `url` STATIC VARIABLE VALUE TO THE REGISTER - static_get: url
# SWITCHING TO THE BLOCK - find: path: .somepath do: # SET REGISTER VALUE TO THE STRING: current url - register_set: "current url" # ADD VALUE OF THE `url` STATIC VARIABLE TO THE END OF THE REGISTER, # USING " is " FOR JOINING VALUES - static_append: field: url joinby: " is " # REGISTER VALUE: current url is http://www.somesite.com # ADD VALUE OF THE `url` STATIC VARIABLE TO THE BEGINNING OF THE REGISTER, # USING " - " FOR JOINING VALUES - static_prepend: field: url joinby: " - " # REGISTER VALUE: http://www.somesite.com - current url is http://www.somesite.com
Next we will tell you how to work with hashes.