すべて!カピバラキュウリの成分の収集方法
可能な私が持っているテーブル
<tabel>
<tr><td><input type=text/></td><td><input type=text/></td></tr>
<tr><td><input type=text/></td><td><input type=text/></td></tr>
<tr><td><input type=text/></td><td><input type=text/></td></tr>
<tr><td><input type=text/></td><td><input type=text/></td></tr>
</table>
私は「XPathを見つけることができません@取得この
table.hashes.each do |hash|
within(:xpath,"//div[@id='cycle_form']/table/tr#{table.hashes.index(hash)}") do
fill_in("schedule_of_working_new_cycle_attributes__day", :with => hash['day'])
fill_in("schedule_of_working_new_cycle_attributes__hour", :with => hash['hour'])
fill_in("schedule_of_working_new_cycle_attributes__hour_night", :with => hash['hour_night'])
end
end
のようなキュウリのステップ定義でサイクルでそれらを埋めたい// divの[ID @ = 'cycle_form']/table/tr [0] "@
カピバラで要素のコレクションを取得するにはどうすればよいですか?これは動作します
<div id="cycle_form">
<table>
<tr><td><input type="text"/></td><td><input type="text"/></td></tr>
<tr><td><input type="text"/></td><td><input type="text"/></td></tr>
<tr><td><input type="text"/></td><td><input type="text"/></td></tr>
<tr><td><input type="text"/></td><td><input type="text"/></td></tr>
</table>
</div>
:
//div[@id='cycle_form']/table/tr[1]
他の事は、XPathインデックス作成が始まる、ということである
htmlのid = "cycleform"でdivの名前を付けてみましたか? – uday
私はこのfind(:xpath、 "// div [@ id = 'cycle_form']/table")のような別のsetipを持っているので、私のdivのid attrの名前を変更しようとしません。have have_css( "tr td input [ @ type = 'text'] ")はパスです。それは動作します – dilshod