A ‘Wait for Element’ failure is a failure caused by the wait for element action in the script. This action is used to wait for a specific element to load before proceeding to the next step. We recommend this as the immediate action after clicking through to a new page or waiting for something to appear such as a pop-up or sidebar.
So why are you getting this failure message? Here are a few reasons starting from most common to least common:
Change in Selector
The most likely cause of this failure is the select you are evaluating has changed. An easy way to identify this is to navigate to the page with the failure on your site and paste the selector into the Dev Tools to check if it is picked up. If nothing is identified then we would recommend changing the selector to something else.
If your selector is present but you are noticing occasional failures on the ‘Wait for Element’ your selector might not be reliable. For example if the selector is located on a form or pop-up sidebar it might not fully load 100% of the time.
Another cause could be if the selector has the potential to change. If you have a selector located on an item of stock and a different product is selected this could cause a failure if the elements are different.
Clickable v Visible Selector
When creating the action you have the choice of ‘Clickable’ and ‘Visible’ as the evaluator for the selector. Both methods have their pros and cons.
Clickable actions check if the element is clickable, this is perfect for checking that buttons have fully leaded such as buttons, navigation and even elements such as text boxes and input fields.
Visible actions check if the element is visible, this is great if you want to check if something is present on the page such as an image or text. The only issue that can occur with this type of action is if something blocks the selector which will cause the failure.
If you have checked that the selector is definitely available and visible but you are still receiving a failure error, it might be due to the selector being hidden. This is something to double check especially if you are evaluating the selector by ‘Visible’ rather than ‘Clickable’.