How do you locate a error message that appears as a tooltip in the browser console? It disappears before I can inspect it. I was thinking the firstname field's error message would be this, but selenium cannot find it.

 static By firstnameerror = By.cssSelector

 WebDriverWait wait = new WebDriverWait (webdriver, 60);
 WebElement create_acct = webdriver.findElement(createacct);

 WebElement iframeSwitch = webdriver.findElement(
 By.id("register-  iframe"));
 WebElement submitbtn = webdriver.findElement(submit);

 String pleasefilloutthisfield = 
 log.info("FirstName error message: "+pleasefilloutthisfield);

enter image description here

  • You can try using a hybrid tool, such as TestComplete or Ranorex, they will help you locate it; having said it, even you can locate this tooltip with a hybrid tool, it does not mean you can find it using Selenium in a console.
    – Yu Zhang
    Commented Apr 5, 2018 at 22:40
  • Thanks. Are those free tools? Commented Apr 5, 2018 at 22:47
  • No, but you can download trial versions
    – Yu Zhang
    Commented Apr 5, 2018 at 22:48

2 Answers 2


I found the answer here.

You can't get the text, but the required attribute defaults to the standard text "please fill out this field", so you can check the required attribute.

 WebElement first_name = webdriver.findElement(firstname);

String pleasefilloutthisfield = first_name.getAttribute("required");

log.info("Got firstName error message: "+pleasefilloutthisfield);

open the URL in Chrome and as soon as your Element appears (the one that disappear quickly ) click F8 , this will stop DOM from running and you can loca

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.