title: Error message after successfully selenium login test to website
body: <p>It's a simple selenium test to login in website. The test is passed if login with wrong username or password. But if you use your real's username and password test is fail, instead of that login is successfully. I believe that problem is in this code:</p>
  
  <pre><code>IWebElement ErrMessage = driver.FindElement(By.ClassName("validation-summary-errors"));
  </code></pre>
  
  <p>How to avoid this error check after successfulled login? Here is all code:</p>
  
  <pre><code>using NUnit.Framework;
  using OpenQA.Selenium;
  using OpenQA.Selenium.Chrome;
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace Logintest
  {
      public class MyFirstTest
      {
          IWebDriver driver = new OpenQA.Selenium.Chrome.ChromeDriver();
          [Test]
          public void myFirstTest()
              {
              driver.Navigate().GoToUrl("https://softuni.bg");
              driver.FindElement(By.LinkText("Login")).Click();
              IWebElement userName = driver.FindElement(By.Name("username"));
              userName.Clear();
              userName.SendKeys("username");
              IWebElement userPass = driver.FindElement(By.Name("password"));
              userPass.Clear();
              userPass.SendKeys("password"); TimeSpan.FromSeconds(10);
              driver.FindElement(By.LinkText("Ok")).Click();
  
              driver.FindElement(By.XPath("/html/body/main/div[2]/div/div[2]/div[1]/form/input[2]")).Submit(); TimeSpan.FromSeconds(10);
              IWebElement ErrMessage = driver.FindElement(By.ClassName("validation-summary-errors"));
              Console.Write(ErrMessage.Text);
              Assert.IsTrue(ErrMessage.Text.Contains("Wrong username or password"));
              driver.Close();
              driver.Quit();
              }
      }
  }
  </code></pre>
  
  <p>This is test fail error:
  <a href="https://i.stack.imgur.com/Zv2TE.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Zv2TE.jpg" alt="enter image description here"></a></p>