Is there anyway to check whether an element is present in Selenium web driver? I try to use this code:
if @driver.find_element(:link, "Save").displayed? == true
but it will break in exception, which is not what I expected because I still want the script to continue running.
@driver.find_elementthrows an exception calledNoSuchElementError.So you can write your own method which uses try catch block and return true when there is no exception and false when there is an exception.