On Thu, Feb 7, 2013 at 2:50 PM, Love U Ruby <[email protected]> wrote: > Hi, > > I have the code below : > > > option.select_by(:text, value) > wbs.cells(rows,9).value = "Done" > rows = rows + 1 > count_dropdown = count_dropdown - 1 > > > Now sometimes I am getting an error as - > "(Selenium::WebDriver::Error::NoSuchElementError)" > > So I tried below : > > option.select_by(:text, value) > > rescue Selenium::WebDriver::Error::NoSuchElementError > > wbs.cells(rows,9).value = "Done" <~~ But I want this line to be skipped > whenever there is an error. > > rows = rows + 1 > count_dropdown = count_dropdown - 1 > > Please guide me how to do that?
The typical way to handle that is begin rescue end: begin code which might raise an exception here rescue TheExceptionType => e handle error end Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/ -- [email protected] | https://groups.google.com/d/forum/ruby-talk-google?hl=en --- You received this message because you are subscribed to the Google Groups "ruby-talk-google" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
