How about using 
browser.alert.wait_while_present

this will wait for the next line of code to execute until alert goes away

On Friday, May 10, 2013 5:42:54 AM UTC+10, dubsbox wrote:
>
> I'm testing a home-grown shopping cart application which has scenarios 
> where adding an item to the cart results in an alert pop-up appearing. 
>  Scenarios that have just a single alert pop-up can be handled with 
> Browser.alert.ok.  I have run into a couple of scenarios where adding an 
> item to the cart results in multiple consecutive alert pop-ups that need to 
> be cleared.  The first alert can be cleared just fine with 
> Browser.alert.ok.  I am then unable to clear the second alert pop-up. 
>  Working this scenario in irb, I see that after issuing the first 
> Browser.alert.ok command, the irb prompt is not returned.  It seems like 
> the second alert pop-up is blocking progress similar to when an alert 
> pop-up is triggered by clicking a button with just .click instead of 
> .click_no_wait.  So, I'm wondering if anyone has run into a similar 
> situation and has a solution.  It looks like there is no .click_no_wait 
> method defined for the alert pop-ups.
>
> For reference, my successful scenarios look like this:
>
> browser.button(:value,"Add To Cart").click_no_wait     # This triggers the 
> alert pop-up.
> ($browser.wait_until(10) { $browser.alert.exists? }) ? ($browser.alert.ok) 
> : ()     # Wait a bit and if alert pop-up exists, click OK.  No additional 
> alert pop-up appears.
>
> My unsuccessful scenarios are when an additional alert pop-up appears 
> after clicking OK on the first alert pop-up.
>
> Thanks.
>
> Johnathan
>
>
>
>

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

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to