Note: The same code works well earlier, but now it's not working. My below code for windows authentication was working well for over a year. But for the last few days it is longer working now. I am not able to identify exact reason for that.
from selenium import webdriver
import time
import win32com.client
driver=webdriver.Chrome('D:/Software/BrowsersDriver/ChromeDriver/chromedriver.exe')
driver.maximize_window()
driver.get("authentication windows url")
shell = win32com.client.Dispatch("WScript.Shell")
shell.Sendkeys("username")
time.sleep(1)
shell.Sendkeys("{TAB}")
time.sleep(1)
shell.Sendkeys("password")
time.sleep(1)
shell.Sendkeys("{ENTER}")
time.sleep(5)
driver.quit()
2018-04-02 07:09:28,230 INFO: Imported existing <module 'comtypes.gen' from 'C:\Python27\lib\site-packages\comtypes\gen\__init__.pyc'>
2018-04-02 07:09:28,230 INFO: Using writeable comtypes cache directory: 'C:\Python27\lib\site-packages\comtypes\gen'
. I am using python 2.7.12 and latest version of chrome driver.