mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Correct problem with partial matches
This commit is contained in:
parent
ac357b8e11
commit
ae48b83ded
2 changed files with 5 additions and 3 deletions
|
@ -84,7 +84,7 @@ module Capybara
|
||||||
|
|
||||||
def add_field(locator)
|
def add_field(locator)
|
||||||
xpath = append(yield(s(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"))
|
xpath.prepend(yield("//label[text()=#{s(locator)}]/@for"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,10 @@
|
||||||
|
|
||||||
<form action="/form" method="post">
|
<form action="/form" method="post">
|
||||||
<p>
|
<p>
|
||||||
<label for="form_first_name">First Name</label>
|
<label for="form_first_name">
|
||||||
|
First Name
|
||||||
<input type="text" name="form[first_name]" value="John" id="form_first_name"/>
|
<input type="text" name="form[first_name]" value="John" id="form_first_name"/>
|
||||||
|
</label>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
Loading…
Reference in a new issue