title: Authentication Popup using Selenium Webdriver Python
body: <p>I'm able to send keys to handle the authentication popup of a site using Selenium and win32com.client. It is working fine when I run the code manually (running a Jupyter Notebook).</p>
  
  <p>The error occurs when I convert .ipynb to .py and schedule it to run automatically using Windows Task Scheduler. It get stuck into the authentication popup window.</p>
  
  <p>I have tried the options below:</p>
  
  <p>1.) This works fine in notebook</p>
  
  <pre><code>shell = comclt.Dispatch("WScript.Shell")
  driver = webdriver.Chrome(chrome_path)
  driver.maximize_window()
  driver.get(url)
  shell.SendKeys("username", + "{TAB}" + "password" + "{TAB}" + "{ENTER}")
  </code></pre>
  
  <p>2.) Just trying some alternatives and its working in notebook  </p>
  
  <pre><code>shell = comclt.Dispatch("WScript.Shell")
  driver = webdriver.Chrome(chrome_path)
  driver.maximize_window()
  driver.get(url)
  
  try:
      alert = driver.switch_to_alert().accept()
      shell.SendKeys("username", + "{TAB}" + "password" + "{TAB}" + "{ENTER}")
  
  except NoAlertPresentException:
      shell.SendKeys("username", + "{TAB}" + "password" + "{TAB}" + "{ENTER}")
  </code></pre>
  
  <p>Is there a better approach on how to run this code (.py) automatically using Task Scheduler? </p>