playwright-ruby-client icon indicating copy to clipboard operation
playwright-ruby-client copied to clipboard

How do I blur an element nicely?

Open mhenrixon opened this issue 10 months ago • 1 comments

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.

mhenrixon avatar Mar 28 '24 09:03 mhenrixon