var alert_win = driver.SwitchTo().Alert(); alert_win.SendKeys("This is a test alert message"); alert_win.Accept();