简体   繁体   English

使用C#模拟确认javascript弹出窗口

[英]Using C# to simulate confirming a javascript popup

So I'm trying to verify the pop-ups occur in my Selenium 2 functional tests. 因此,我试图验证弹出窗口是否出现在Selenium 2功能测试中。 Right now there seems to be no built-in way for selenium 2 to handle these. 目前,硒2似乎没有内置的方法来处理这些问题。 Is there a way to create C# code that will notice an alert, and simulate hitting the "Enter" key? 有没有一种方法可以创建将注意到警报的C#代码并模拟按下“ Enter”键?

Webdriver does not handle javascript alerts yet. Webdriver尚未处理javascript警报。 The issue is know and already has a defect created, you can monitor the status here http://code.google.com/p/selenium/issues/detail?id=27&colspec=ID%20Stars%20Type%20Status%20Priority%20Milestone%20Owner%20Summary 问题是已知的,并且已经创建了缺陷,您可以在此处监视状态http://code.google.com/p/selenium/issues/detail?id=27&colspec=ID%20Stars%20Type%20Status%20Priority%20Milestone %20Owner%20摘要

That page also has some work around using javascript that you can try. 该页面还提供了一些有关尝试使用javascript的工作。

通常,处理弹出窗口是一件很难的事情。.据我所知,处理它们的唯一框架是WatiN,处理它们确实花费很多时间(找到弹出窗口可能要花费30秒以上的时间)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM