我有這樣的代碼在我的網頁水豚/黃瓜曖昧匹配類似的標籤
<div>
<label for="user_password">Heslo</label>
<br />
<input id="user_password" name="user[password]" size="30" type="password">
</div>
<div>
<label for="user_password_confirmation">Heslo pro kontrolu</label>
<br>
<input id="user_password_confirmation" name="user[password_confirmation]" size="30" type="password">
</div>
而且我想在黃瓜使用這些步驟:
And I fill in "Heslo" with "NeznameHeslo328"
And I fill in "Heslo pro konrolu" with "NeznameHeslo328"
步驟簡單定義是:
When /^I fill in "([^"]*)" with "([^"]*)"$/ do |name, text|
fill_in(name, :with => text)
end
但是 水豚提高模糊匹配找到2 el匹配字段「Heslo」(水豚::含糊) 第一步。
當我將標籤中的名稱更改爲for="user_password_confirmation"
爲「Hesla pro kontrolu」(和相應的第二步)時,一切正常。
有沒有什麼辦法可以強迫Capybara在標籤內匹配確切的短語?在場景中不使用css選擇器。
感謝您的通知。我會做一些解決方法。 – Foton