seleniumselenium-webdriverxpathconstraint-validation-api

How to get the text from mouseover popup element using Selenium Webdriver


I am trying to get the text of the mouseover on the login page from the email field.

This is the site "https://app.involve.me/login/?_ga=2.49216998.1374332121.1660294616-36640509.1660294616"

If you will leave the fields empty and try to log in a popup will appear with the following message:

Please fill out this field

I cannot get the text from it. I tried as an alert, tooltip nothing works. There is no path to it.

Element snapshot:

enter image description here


Solution

  • The text of the mousehover on the login page from the email field which you are referring is the outcome of Constraint API's element.setCustomValidity() method.

    Note: HTML5 Constraint validation doesn't remove the need for validation on the server side. Even though far fewer invalid form requests are to be expected, invalid ones can still be sent by non-compliant browsers (for instance, browsers without HTML5 and without JavaScript) or by bad guys trying to trick your web application. Therefore, like with HTML4, you need to also validate input constraints on the server side, in a way that is consistent with what is done on the client side.


    Solution

    To retrieve the text which results out from the element.setCustomValidity() method, you can use either of the following Locator Strategies: