I was wondering if there's any solution for getting text of a web element if it's present on screen?
Application which I'm automating right now is sometimes displaying unexpected error alert with error code. I want to create a listener that gets the text of the error alert if it's displayed and prints it into console.
I'm using TestNG framework with Selenium WebDriver and Java.
I tried to find any solution on the web but none answered my problem. Only found a way to take screenshot on test fail which is not really solution to my problem.