Hey all.

I've tried searching for this on my own but looking for specific
solutions in Watir or Watir-WebDriver is often a needle in a haystack
venture. In this case, I have an application that has a JavaScript
alert that pops up when an OK button is clicked. I need to get the
message in the alert box and then click OK to get rid of it.

I can do this easily in Selenium (most notably using the alertAssert)
but I'm having trouble seeing how to do it in Watir.

I saw this page: http://wiki.openqa.org/display/WTR/JavaScript+Pop+Ups.
It mentions this line:

$ie.javascript_dialog.button('OK').click

That does nothing for me but I'm using watir-webdriver as opposed to
just watir so that might be why that is.

Some of the blog posts (like 
http://watir.com/2011/01/14/testing-webpages-with-javascript-popups-correctly/)
I've found indicate more how you can just ignore the JavaScript alert
-- but that's not a good way to do things if your application requires
the alert to be present and show text. I have to test for that. I
would be okay with dismissing the alert if there was some equivalent
of Selenium's assertAlert so that I could at least get the message
returned.

Any thoughts? Not being able to handle JavaScript dialogs -- annoying
as they are -- is definitely a deal breaker so I'm open to any
suggestions.

- Jeff


-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to