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).
An earlier related question here on SO is: How do I test error conditions in HTML5 pages with cucumber?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…