Waiting for ajax_message_num_1 works only on first AJAX request and
we're doing more of them. This should remove need for many consequent
sleeps as we were actually not properly waiting for element.
Also it's better to wrap this logic in separate method as it is used in
many places in the code.
Signed-off-by: Michal Čihař <michal@cihar.com>