HI ,
Am automating a website, when tried to login its dispalying one security alert pop up. Wanted to click "Yes" of that pop up,Can anyone give the solution for this.
HI ,
Am automating a website, when tried to login its dispalying one security alert pop up. Wanted to click "Yes" of that pop up,Can anyone give the solution for this.
There are two ways to handle this, add a dialog handler at the start of the test or add one explicitly when you need it. Here is how you add one at the start that runs is a seperate thread.
IE ie = new IE();
ie.AddDialogHandler( new SecurityDialoghandLer() .. or the appropriate dialog handler ...);
The rest of your test ...
I had a mix of security warnings and certificate warnings every time the server got new code. This works for me:
browser.AddDialogHandler(new DialogHandlerHelper());
browser.AddDialogHandler(new SecurityAlertDialogHandler());
Assert.IsTrue(browser.Link(Find.ByText("Login")).Exists);
browser.Link(Find.ByText("Login")).Click();
if (browser.Element("expertContentHeading").Exists)
{
browser.Element("expertContentHeading").Click();
browser.Button("exceptionDialogButton").Click();
int Handle = browser.hWnd.ToInt32();
object BT = true;
WshShell WSH = new WshShell();
WSH.SendKeys("{TAB}", ref BT);
WSH.SendKeys("{TAB}", ref BT);
WSH.SendKeys("{TAB}", ref BT);
WSH.SendKeys("{TAB}", ref BT);
WSH.SendKeys("{ENTER}", ref BT);
}
if (browser.Links.Exists("overridelink"))
{
browser.Link("overridelink").Click();
}