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