Reputation: 13195
It seems that using send_keys
in Capybara always first fires a click
element on the given input.
Is there a way to bypass this, e.g. when I know I already have set focus to the input (and for some reason don't want a click
event to be fired)?
By the way, I'm using PhantomJS.
Upvotes: 1
Views: 517
Reputation: 49900
Poltergeist clicks the element before sending keys to it to ensure it is the element in focus - https://github.com/teampoltergeist/poltergeist/blob/master/lib/capybara/poltergeist/client/browser.coffee#L365 . As you can see from the code the click is skipped if the element already contains a selection which is defined by https://github.com/teampoltergeist/poltergeist/blob/master/lib/capybara/poltergeist/client/browser.coffee#L365 . So the only supported way to skip the click would be to ensure the selection is already in the element you want to send keys to.
Upvotes: 2