Dynamic Wait

Please check:

It might give you a starting point.