You could overwrite the alert function in JavaScript before triggering the 
first alert. Something like this:
browser.execute_script "window.alert = function() {}"

Jarmo Pertman
-----
IT does really matter - http://itreallymatters.net


On Friday, May 10, 2013 10:19:39 PM UTC+3, dubsbox wrote:
>
> Thank you for the response, Ankita.  Unfortunately, it appears that using 
> the browser.alert.wait_while_present does not help me move forward to close 
> out the second alert pop-up.  Rather, it achieves the same result of 
> "hanging" my script when the second pop-up appears.  This makes sense as 
> wait_while_present does the following: "Wait while element is present 
> before continuing."  What I'm looking for is the opposite - no waiting 
> while the element is present before continuing.
>
> On Thursday, May 9, 2013 6:59:05 PM UTC-7, Ankita@Adslot wrote:
>>
>> 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.

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

--- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to