Check if “Please enter an email address” message appears

On March 26, 2013 by Željko Filipin
Golden Gate Bridge

Random photo: Golden Gate Bridge, San Francisco

I have exchanged a few e-mails with Karlo Šmid on how to check if “Please enter an email address” message appears. I think it is an interesting question, so I will cross post my question from Stack Overflow here.

Given a simple page:

<form>
  <input type="email">
  <button>click</button>
</form>

If I enter anything in text field that is not e-mail and click the button, Please enter an email address message appears.

Is there a way to to check if the message appears using Selenium or Watir? As far as I see, nothing new appears in browser DOM.

Since the page is using e-mail check that is built in feature of a browser, does it even make sense to check that error message appears? It is at the same level as checking if browser scroll bar works. We are no longer checking the web application, but the platform (browser).

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>