Filipin.eu

Željko Filipin's blog.
Home Blog Tags Now License

View on GitHub
26 March 2013

Check if "Please enter an email address" message appears

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).

tags: code