问题
I have a following problem. After Submit some date on page I have a modal dialog like on the picture:

I want to click "ENTER" to go through that modal but it does not work. I have following code:
driver.FindElement(By.CssSelector("input.submit")).Click();
Actions action = new Actions(driver);
action.SendKeys(OpenQA.Selenium.Keys.Enter);
After click on continue manually test go back to next page. I must go through this modal to continue the test. Any ideas how to solve this problem?
回答1:
I found a solution by following code:
IAlert alert = driver.SwitchTo().Alert();
alert.Accept();
It works for me.
回答2:
In java:
Alert alert = m_driver.switchTo().alert();
alert.accept();
来源:https://stackoverflow.com/questions/25991089/selenium-modal-dialog-present-how-to-accept-information