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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -