title: selenium : how to handle error messages that get displayed when we dont give credentails
body: <p>I am new to selenium, and when testing a web application I want to check when credentials are wrong the message in alert which gets displayed and the error message that is displayed on the page after accepting the alert are same or not please can anybody help me how can I do this</p>
  
  <p>I have handled alert using</p>
  
  <pre><code>web.swichto.alert().accept
  </code></pre>
  
  <p>but I want to compare the message that alert displays and the error message that is displayed in that page like </p>
  
  <p>Error: Invalid User ID/Password Or Network Is Down!</p>
  
  <p>and message in alert box like</p>
  
  <p>Invalid username/password </p>
  
  <p>thanks in advance</p>