The object life cycle and waits
Firstly, here’s what I call the ‘object life cycle’:
In UI automation objects we use have a specific pattern that keeps repeating.
These steps are 1) Wait for object, 2) Find object, 3 Perform action on object – Repeat.
I call this the object life cycle, and it is the lifeline for a UI automation framework.
The first step wait is – Wait before ‘finding’ EVERY object.
Web communication is asynchronous, which means it all depends on the timings of user actions and responses,
That means, we can never be sure of timings for any interaction.
Therefore, according to Murphy’s law, ‘What can go wrong will go wrong’, prepare for the worst.
In our context, the object we want to work with will NOT be there, so be prepared for it.
BTW – Adding a 5 second delay (static delay) is BAD, because it’s always going to be less than needed or more than needed
Delays have to be dynamic (based on a condition), to wait for the precise time you want them to.
#QsDaily #automation #framework