简体   繁体   中英

Using C# to simulate confirming a javascript popup

So I'm trying to verify the pop-ups occur in my Selenium 2 functional tests. Right now there seems to be no built-in way for selenium 2 to handle these. Is there a way to create C# code that will notice an alert, and simulate hitting the "Enter" key?

Webdriver does not handle javascript alerts yet. 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

That page also has some work around using javascript that you can try.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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