Put that line of code in your before hook. When an unexpected alert pops
up, it'll tell you what exactly was just sent to the browser that caused
it. It spits out a lot of text to console, so hopefully the issue is
happening frequently enough that you can turn it on for a short time and
pinpoint the issue.
On Tuesday, December 4, 2018 at 8:02:39 PM UTC-7, NaviHan wrote:
>
> Thanks Titus, Yes I know the issue with, "Watir::Wait.until {element}" this
> is all over our automation code , the previous automation tester did this
> practise. In on my list to clean this up
>
> But sorry I didnt quite understand the statement "Also log the wire calls
> getting sent to the driver to see exactly what is causing the alert
> (`Selenium::WebDriver.logger.level = :info`)". Could you please a bit more
> clear..
>
> On Wednesday, 5 December 2018 13:31:56 UTC+11, NaviHan wrote:
>>
>> Im having a tough time with this intermittent error I get on checkout
>> page once all the details are filled and customer hits payment button.
>>
>> Sometimes
>> Selenium::WebDriver::Error::UnhandledAlertError: unexpected alert open: {
>> Alert text : Bad response - parser error!}
>>
>>
>>
>> (Session info: chrome=70.0.3538.102)
>>
>> (Driver info: chromedriver=2.41.578737 (
>> 49da6702b16031c40d63e5618de03a32ff6c197e),platform=Windows NT 6.1.7601
>> SP1 x86_64)
>>
>> ./features/support/pages/Frontend/Cotton_On/Thankyou_Page.rb:91:in
>> `find_dw_order_number'
>>
>>
>> ./features/step_definitions/Checkout_Page_steps.rb:1395:in `block (2
>> levels) in <top (required)>'
>>
>> ./features/step_definitions/Checkout_Page_steps.rb:1394:in `/^Thankyou
>> page is shown with details for the user$/'
>>
>> ./features/Giftcards-AU.feature:233:in `Then Thankyou page is shown with
>> details for the user'
>>
>>
>>
>> Sometimes
>>
>> Selenium::WebDriver::Error::UnhandledAlertError: unexpected alert open: {
>> Alert text : Couldn't load credit card!}
>>
>>
>>
>> (Session info: chrome=70.0.3538.102)
>>
>> (Driver info: chromedriver=2.41.578737
>> (49da6702b16031c40d63e5618de03a32ff6c197e),platform=Windows NT 6.1.7601 SP1
>> x86_64)
>>
>>
>>
>>
>> In order for the dev to have a look I need to give them the browser
>> console logs at the point of failure. What happens is that some times I get
>> the error on "wait_for_ajax" and some time on "wait_and_click" method. The
>> test exits abruptly with the errors above and no screenshots ate taken
>>
>> Is there a way I can get the browser console logs at this point?
>>
>>
>>
>> def place_order
>> wait_for_ajax
>> wait_and_click place_order_btn_element
>> end
>>
>>
>> def wait_and_click element
>> begin
>> retries ||= 0
>> Watir::Wait.until {element}.focus
>> Watir::Wait.until {element}.click
>> rescue Selenium::WebDriver::Error::UnknownError
>> retry if (retries += 1) < $code_retry
>> rescue Watir::Exception::UnknownObjectException
>> retry if (retries += 1) < $code_retry
>> end
>> end
>>
>>
>>
>>
>>
--
--
Before posting, please read
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
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/d/optout.