views:

54

answers:

2

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?

+1  A: 

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.

Reflux
Have you by chance tried the workarounds? I'm probably going to give a few of them a shot and see what happens.
James
No I haven't sorry.
Reflux
A: 

Generally, handling pop-ups is a pretty hard thing.. the only framework I know of that handles them is WatiN & it really takes lots of time to handle them (it might take it over 30 sec to find a pop-up)

Shady M. Najib
Actually Selenium 1 handles Alerts. However in the .net version of Selenium 2 WebDriverBackedSelenium doesn't seem to be working.
Reflux
Yeah, I noticed that too, Reflux.
James
And 30 sec in WatiN seems crazy, one would want these tests to be fast!
James