我想检查span
= id
是否存在"Error_Title"
。由于这种情况,我有时间超时。我不知道在这种情况下应该处理异常的位置。
if(ie.span(:id,"Error_Title").exists?)
puts "yes it is there"
end
答案 0 :(得分:0)
根据How can I avoid program termination caused by watir-webdriver timeout error while loading a webpage?,这应该有效(未经测试):
begin
if(ie.span(:id,"Error_Title").exists?)
puts "yes it is there"
end
rescue Timeout::Error
puts "Gotcha!"
end