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
上面的代码失败了
错误:无法将 Watir::TextField 转换为字符串 (TypeError)