playwright-ruby-client
playwright-ruby-client copied to clipboard
How do I blur an element nicely?
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:
def fill_in_then_blur(locator, with:)
fill_in(locator, with:)
find_field(locator).native.send_keys :tab # Tab away from the element to trigger a blur event.
end
I also tried page.keyboad.press("Tab")
but it seems that didn't work either. Love your work, appreciate your assistance. Cheers.