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:
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.
To retrieve the text which results out from the element.setCustomValidity()
method, you can use either of the following Locator Strategies:
Using Python and CssSelector:
Code Block:
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
driver.execute("get", {'url': 'https://app.involve.me/login/?_ga=2.49216998.1374332121.1660294616-36640509.1660294616'})
print(WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input[name='email']"))).get_attribute("validationMessage"))
Console Output:
Please fill out this field.
Using Java and Xpath:
Code Block:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class validationmessage {
public static void main(String[] args) {
driver.get("https://app.involve.me/login/?_ga=2.49216998.1374332121.1660294616-36640509.1660294616");
System.out.println(new WebDriverWait(driver, Duration.ofSeconds(10)).until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@name='email']"))).getAttribute("validationMessage"));
}
}
Console Output:
Please fill out this field.