title: Selenium: Entering Username + Password
body: <p>I'm currently writing a piece of testing software using C# and Selenium. I'm trying to input a username and password and use the login feature of the website but everytime the form is submitted it comes back as an invalid username or password, I believe that it's trying to enter the data either duplicate times or entering data in the wrong field.</p>
  
  <p>This is my code:</p>
  
  <pre><code>        private static void LogInAsUser()
      {
          Driver.FindElement(By.XPath("//a[contains(@href, '#login-window')]")).Click();
          Driver.FindElement(By.XPath("//input[contains(@id, 'UserName')]")).Click();
          Driver.FindElement(By.XPath("//input[contains(@id, 'UserName')]" )).SendKeys("exampleuser@exampleemail.com");
          Driver.FindElement(By.XPath("//input[contains(@id, 'Password')]")).Click();
          Driver.FindElement(By.XPath("//input[contains(@id, 'Password')]")).SendKeys("example");
          Driver.FindElement(By.XPath("//input[contains(@id, 'Password')]")).Submit();
          //Driver.FindElement(By.Id("btnLogin")).Submit(); //*[@id="btnLogin"] //*[@id="login-window"]/div/div/div[3]/div[1]/div
          {
          Result.Pass(60);
          }
      }
  </code></pre>
  
  <p>Not the cleanest of code I know but any help would be appreciated.</p>