Our product relies heavily on the onBlur event, but watir-webdriver does not
always seem to fire that particular event.
watir-webdriver: 0.6.4
chromedriver: 2.8
I have found two occasions when this is true in Chrome:
1. I am interacting with a window other than the browser
2. When the URL area of the browser has the focus.
The following is the code I am using (pretty reliant on page_object as well):
When(/^I create a transaction with amount "(.*?)" and code "(.*?)"$/) do
|amount, code|
on_page(PaymentPage).click_button("add_payment")
on_page(PaymentPage).code = code
on_page(PaymentPage).amount = amount
on_page(PaymentPage).click_button("save")
end
In order for the save to work correctly, the onBlur event must have fired when
amount is set (some validation we have set up). Basically, a user types in 20
and the onBlur event fires and changes it to $20.00. If the event doesn't fire,
the save doesn't occur, and my tests break.
If I click anywhere but the URL before this code runs, and I do not switch
pages, this code succeeds 100% of the time.
If I switch pages, it will fail. If I click URL area, it will fail.
If I add this code in after setting amount:
on_page(PaymentPage).amount_element.element.fire_event("onBlur")
It works.
Thanks very much for your time.
---
Reply to this email directly or view it on GitHub:
https://github.com/watir/watir-webdriver/issues/255_______________________________________________
Wtr-development mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-development