Selenium test cases are failed for a modal popup window

399 Views Asked by At

All Test cases fail after execution of a test case where a redirection to CRM URL is present. It opens the URL in the browser with a credential popup of crm. It says the following message

"An exception of type 'OpenQA.Selenium.UnhandledAlertException' occurred in WebDriver.dll 
but was not handled in user code  Additional information: Modal dialog present".

I have used the below code to handle the issue. But it is not working. Code snippet I used:

String mainWindowHandle = Driver.CurrentWindowHandle.ToString();
        ReusableFuncPage.GetTxtfirstname().SendKeys(Keys.Enter);           
        Driver.SwitchTo().Window(mainWindowHandle);

How do I close the credential Modal dialog and return to the parent window to continue the rest of test cases?

0

There are 0 best solutions below