This action is designed for selecting an item at random from a predefined list of items. The item is then available in the
$RapidStore namespace for use in other areas of a script.
An example use for this action would be for selecting a search term at random and then using it in a SendKeys action to enter the search term in a text field.
Firstly, we need to configure the PickItem action. Here we are defining a list of three search terms (items) to pick from and the name to assign the selected item to in the
Next, we need to use the selected item in a SendKeys action. We do this using the ‘Name’ attribute from the PickItem actions and dot notation to access the
$RapidStore.SearchTerm. This example does exactly that and inputs the value into the
#search.input-text input field:
Finally, the full step put together. The prerequisite is that the journey is on a page with the search field present and the intention of the step is to pick a search term at random, enter it into the search field, submit the search and wait for products to be returned.