(Solved) – Get text from alert message from web with Selenium and VBA


I am currently creating an automation to fill-in field in the browser (Chrome) with VBA and selenium. Which is currently doing fine. (the site is internal)

However, I came across with this “message from web” prompt after saving / submitting the information. Sometimes, this pop-up box gives me a prompt that it was saved successfully and sometimes, if there are errors, the message box contains some text.

In order for me to handle this pop-up message box and put some validation. In this case, I would like to get the text inside this message box. (Please refer to the red arrow).

enter image description here

The code below is what I used in order to accept / click the “OK” button. And doesn’t have any problems. However, as mentioned, I would like to get the text inside that box to put some validation.

What I tried so far:

driver.SwitchToAlert.Text <<<--- this is where I attempt to get the text however, it doesn't work.

Also, I have check below code:


However, this seems not to be working in VBA / selenium.

Leave a Reply

Your email address will not be published. Required fields are marked *