Get text on alert prompt

How can I get the text value on alert prompt / confirmation message?

For this example:
. Please try again.

Thank you!
Hope someone can help.

I can think of two methods:

  1. Use ExecuteScript plus some Javascript:

  2. Switch to desktop automation and use the OCRExtract command (OCR screen scraping)

Thank you, @ulrich! I have given these two a try before posting here on the forum but I havent had any luck! I will try again and let you know.