Capture delay and ON/OFF new page appearance

Hi, I am trying to automate the following scenarios:
After clicking on the “Send” button , there may be a delay of up to 5 seconds for the next page to appear, and then next page can be opened with:
#1) Completed button or
#2) 'We are processing ’ message and Cancel button or
#3) message “Please wait” and there is no button … then this page can be replaced with page #1 or #2 or #4 …this is on/off process between all the pages . The timeout for this process is 30 seconds.
#4) Process Failed message and an OK button.

I can complete the process for scenario # 1 or press the button for scenarios # 2 and # 4.
The following code does not work for me if it is a delay when opening a new page or scenario # 3.
Please advise how you can catch the delay when opening a new page and scenarios # 3?

{buttonCompleted} Run Keyword And Return Status Element Should Be Visible //scenario#1 Run Keyword If '{buttonCompleted}’==‘True’ Click Element //buttonCompleted
… ELSE Click Element //button