我有一张像这样的单元格的表:
<td colspan="2">
<label for="stammdaten_bundesland_id">Bundesland</label>
Nordrhein-Westfalen
</td>
如何使用label?
访问td中的文本我想有一步:
I should see "Nordrhein-Westfalen" within cell with label for "stammdaten_bundesland_id"
答案 0 :(得分:1)
我认为应该这样做:
Then /^I should see "([^"]*)" within the cell with label for "([^"]*)"$/ do |text, label|
page.should have_xpath("//td[./label[@for=\"#{label}\"]]", :text => text)
end