title: How to handle browser authentication in Chrome using Selenium Webdriver (C#)?
body: <p>I am writing an automation script for Chrome browser in selenium web driver using C#. I got stuck in a scenario where multiple tabs are getting open in the same browser and I need to navigate to the first Tab of a browser and need to re-enter the login credentials in the authentication dialog box.</p>
  
  <p>Please find the below screenshot for authorization window:</p>
  
  <p><a href="https://i.stack.imgur.com/VlJTV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VlJTV.png" alt="enter image description here"></a></p>
  
  <p>I am unable to navigate to the first tab and unable to pass the username &amp; password. I found some answers in the Stackoverflow and tried in my script but nothing went right. Here is my sample code:</p>
  
  <pre><code>WebDriverWait wait = new WebDriverWait(driver, 10);
  IAlert alert = wait.Until(ExpectedConditions.AlertIsPresent());
  alert.SetAuthenticationCredentials(username, pwd);
  </code></pre>
  
  <p>After executing the above code, the following error is coming:</p>
  
  <blockquote>
    <p>WebDriverWait has some invalid arguments.
    Argument '2': cannot convert from 'int' to 'System.TimeSpan'</p>
  </blockquote>
  
  <p>Is there any specific code for Chrome browser? I am using Visual studio 2008.</p>