title: How to switch focus to browser popup using selenium webdriver c#
body: <p>I need to accept a web browser popup which comes on refreshing the website.
  I have used following script to refresh the web site -</p>
  
  <pre><code>driver.FindElement(By.Id("all_bt")).SendKeys(Keys.F5);  
  </code></pre>
  
  <p>After that I used below code to accept the web browser popup.</p>
  
  <pre><code>IAlert alert = driver.SwitchTo().Alert();
                      Thread.Sleep(3000);
                      alert.Accept();
  </code></pre>
  
  <p>But I am getting error as Alert not found.
  I believe the focus is not on the popup, that may be the reason.
  Can anybody help me on this?</p>