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).
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 driver.SwitchToAlert.Text <<<--- this is where I attempt to get the text however, it doesn't work. driver.SwitchToAlert(20).accept
Also, I have check below code:
However, this seems not to be working in VBA / selenium.