for i in 0..10
if @b.text_field(:cols => "40", :index => i).exists?
id = @b.text_field(:cols => "40", :index => i)
if profile_profile_qualifications_attributes_new_(\d)+_comment/.match(id)
@b.text_field(:cols => "40", :index => i).set "Rock!"
end
end
end
上面的代码失败了
Error: can't convert Watir::TextField to String (TypeError)
答案 0 :(得分:1)
id = @b.text_field(:cols => "40", :index => i).id