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?
Thanks
On Thu, Feb 7, 2013 at 2:50 PM, Love U Ruby [email protected]
wrote:
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
Robert K. wrote in post #1095743:
On Thu, Feb 7, 2013 at 2:50 PM, Love U Ruby [email protected]
wrote:
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
I think you missed my point.
Thanks
On Thu, Feb 7, 2013 at 3:34 PM, Love U Ruby [email protected]
wrote:
rescue Selenium::WebDriver::Error::NoSuchElementError
end
#print “nothing”
rows = rows + 1
count_dropdown = count_dropdown - 1
And now where exactly did I miss your point? This is what I suggested.
Cheers
robert
Robert K. wrote in post #1095764:
On Thu, Feb 7, 2013 at 3:34 PM, Love U Ruby [email protected]
wrote:
rescue Selenium::WebDriver::Error::NoSuchElementError
end
#print “nothing”
rows = rows + 1
count_dropdown = count_dropdown - 1
I couldn’t read your code well, as it was folded within it.
Thanks
You need to slow down and read everything more carefully. A lot more of
your problems will solve themselves that way.
Love U Ruby wrote in post #1095742:
Hi,
I have the code below :
begin
option.select_by(:text, value)
wbs.cells(rows,9).value = “Done” <~~~~ Found the resolutions here
rescue Selenium::WebDriver::Error::NoSuchElementError
end
#print “nothing”
rows = rows + 1
count_dropdown = count_dropdown - 1
my-ruby
8
Another construct here:
begin
option.select_by(:text, value)
rescue Selenium::WebDriver::Error::NoSuchElementError
p “do nothing”
else
wbs.cells(rows,9).value = “Done” <~~~~ Found the resolutions here
end
#print “nothing”
rows = rows + 1
count_dropdown = count_dropdown - 1