title: Can't log in to site under Selenium WebDriver
body: <p>I am having a strange issue where I am unable to log into a site under test with the Selenium WebDriver, but am not having any issues logging in when running the project under test in Visual Studio, or in our QA environment.</p>
  
  <p>I have broken the test down to the most simplistic example, where it allows me to manually enter the username, password, and click the login button while it waits for verification that it has moved on to the next screen (waits for an element on that page).</p>
  
  <p>All that happens when running under Selenium is a page refresh.</p>
  
  <p>The test:</p>
  
  <pre><code>driver.Navigate().GoToUrl(this._baseURL + "Account/Index");
  var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
  wait.Until(drv =&gt; drv.FindElement(By.Id("element-on-next-page")));
  </code></pre>
  
  <p>The login button calls the jQuery <code>$.ajax</code> method to POST data to a service, and is correctly going into the <code>success()</code> method.  The service returns a redirect URL.</p>
  
  <p>This, in turn, attempts to redirect, which works when working with the site manually, but simply re-loads the login page when under a Selenium test:</p>
  
  <pre><code>window.location.replace(location.origin + result.RedirectTo);
  </code></pre>
  
  <p>I have verified that the result.RedirectTo is valid when the test is running (it is the page it should be redirecting to for successful login).</p>
  
  <blockquote>
    <p>Tested with Chrome 71.0.3578.98, Firefox 64.0.2 and IE 11.472.17134.0.  It works fine manually in all three.</p>
  </blockquote>
  
  <p>I am unsure why this behavior is acting differently under automation.</p>
  
  <p><strong>UPDATE</strong>: The page it is attempting to redirect to has an <code>[Authorize()]</code> attribute on the controller.  Removing this attribute allows the test to pass.  The attribute only causes Selenium tests to fail, not manual testing.</p>