Here when we click on the below element it's asking for the name.
driver.FindElement(By.XPath("//input[@value='I dare you to click me!']")).Click();
IAlert alert = driver.SwitchTo().Alert(); //Switch to Alert
IWebElement name = driver.SwitchTo().ActiveElement(); // Switch driver to Active Element
name.SendKeys("anjaneyulu");
alert.Accept();
IAlert alert2 = driver.SwitchTo().Alert();
string text = alert2.Text;
Console.WriteLine(text);
alert2.Accept();
driver.FindElement(By.XPath("//input[@value='I dare you to click me!']")).Click();
IAlert alert = driver.SwitchTo().Alert(); //Switch to Alert
IWebElement name = driver.SwitchTo().ActiveElement(); // Switch driver to Active Element
name.SendKeys("anjaneyulu");
alert.Accept();
IAlert alert2 = driver.SwitchTo().Alert();
string text = alert2.Text;
Console.WriteLine(text);
alert2.Accept();
Please this code doesn't work for native widows prompt.. please can you provide similar step by step on how you can authenticate on a Windows prompt.. thank you
ReplyDelete