jnicklas/capybara — Issue #610: Supply element objects to actions
Author: Odaeus
Created: 2012-01-12 01:02:41+00:00
State: open

I sometimes come across a situation where it would be convenient to supply an already-found element to actions such as `fill_in`. For example:

````ruby
context "search" do
let(:search_field) { find_field("search") }
let(:search_button) { find_button(I18n.t("accounts.show.search")) }

before do
visit accounts_path
end

it "should search accounts" do
fill_in search_field, with: "test"
click_on search_button
end
end
````

I could write `search_field.set("test")` or set the field names only but both options seem less elegant.

I was wondering if this is a bad approach or if it's functionality you'd be willing to accept a patch for?