As discussed in 1.1.4 Script Structure, scripts are made up of two components; Steps and Actions.
We recommend that you keep to a Step per page visited on the target website and that all actions within a Step only relate to its page.
To achieve this, the basic best practice Action layout within a Step should be:
The Step should start with a Click because this initiates the new page to load. We do this so that all performance data relating to that page is recorded and stored against the correct Step.
The WaitForElement ensures that the page is rendered correctly and ready for use. This Action allows you to set a condition of “Visible” or “Clickable”. If the condition is not met, this action will fail and the journey will stop.
Finally, the Screenshot is so that you have a visual record of the state that the website is in at this point. This will help when dealing with test failures in the future.
If there are other Actions that need to be taken on the Step’s target page then we recommend that they are added between the WaitForElement and the Screenshot. For example, if you wish to complete a form then add a Form or EnterText action at that point.
Remember: every Step should start with a Click and end with a Screenshot. If they don’t, then consider restructuring your script.