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