硒 - 模态对话框礼物 - 如何接受信息? [英] Selenium - Modal dialog present - how to accept information?

查看:101
本文介绍了硒 - 模态对话框礼物 - 如何接受信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题。发布日期的一些页面上我有一个模态对话框像照片后:

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

我要点击ENTER要经过该模式,但它不工作。
我有下面的代码:

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?

推荐答案

我发现通过下面的代码的解决方案:

I found a solution by following code:

IAlert alert = driver.SwitchTo().Alert();
alert.Accept();



这为我工作。

It works for me.

这篇关于硒 - 模态对话框礼物 - 如何接受信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆