diff --git a/lib/capybara/xpath.rb b/lib/capybara/xpath.rb index 6535787c..57145d05 100644 --- a/lib/capybara/xpath.rb +++ b/lib/capybara/xpath.rb @@ -84,7 +84,7 @@ module Capybara def add_field(locator) xpath = append(yield(s(locator))) - xpath.append(yield("//label[contains(.,#{s(locator)})]/@for")) + xpath = xpath.append(yield("//label[contains(.,#{s(locator)})]/@for")) xpath.prepend(yield("//label[text()=#{s(locator)}]/@for")) end diff --git a/spec/views/form.erb b/spec/views/form.erb index 48e0e294..f98ffb8b 100644 --- a/spec/views/form.erb +++ b/spec/views/form.erb @@ -2,8 +2,10 @@