所有!如何獲得水豚黃瓜元素集合
可能我有一個表
<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>
我想填補他們的週期,這樣
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
我得到@找不到XPath的「黃瓜步驟定義// DIV [@ ID = 'cycle_form']/table/tr [0]「@
如何獲得水豚元素的集合?
你有沒有嘗試在html中用id =「cycleform」命名你的div? – uday 2012-02-08 18:42:56
我不嘗試重命名我的div的id屬性,因爲我有另一個這樣的setip find(:xpath,「// div [@ id ='cycle_form']/table」)。should have_css(「tr td input [ @ type ='text']「)是通過。它的工作 – dilshod 2012-02-08 19:17:52