ruby - How to handle exception in if condition using watir -
i want check whether span
id
= "error_title"
exists or not. getting time out exception due condition. not know exception should handled in type of condition.
if(ie.span(:id,"error_title").exists?) puts "yes there" end
according how can avoid program termination caused watir-webdriver timeout error while loading webpage? , should work(untested):
begin if(ie.span(:id,"error_title").exists?) puts "yes there" end rescue timeout::error puts "gotcha!" end
Comments
Post a Comment