Closed mhenrixon closed 7 months ago
@mhenrixon Hi, Locator#blur would be the best way for it.
Feel free to reopen the issue if needed.
@YusukeIwaki not sure what you are refering to but:
The following works:
def fill_in_then_blur(locator, with:)
find_by_id(locator).set(with).send_keys :tab
end
The following does not:
def fill_in_then_blur(locator, with:)
find_by_id(locator).set(with).blur
end
I thought the locator would be the result of the find. What am I missing?
1) Cars can add and sell cars
Failure/Error: find_by_id(locator).blur
NoMethodError:
undefined method `blur' for an instance of Capybara::Node::Element
[Screenshot Image]: tmp/capybara/screenshots/failures_r_spec_example_groups_cars_can_add_and_sell_cars_553.png
Usecase / What to achieve
I have some calculations that run on blur (lost focus). I want a concise way to blur that element by filling it in.
Question
I found this old code on the internet:
I also tried
page.keyboad.press("Tab")
but it seems that didn't work either. Love your work, appreciate your assistance. Cheers.