I need your help. I just want to continue my Selenium IDE script on Firefox even there's an error or element not found. I'm using script with HTML format.
Ideally, the exception occurs due to the use of incorrect element locators in the findElement(By, by) method. To handle this exception, use the wait command. Use Try/Catch to ensure that the program flow is interrupted if the wait command doesn't help.
The exception occurs when WebDriver is unable to find and locate elements. Usually, this happens when the tester writes incorrect element locator in the findElement(By, by) method. with the spaces and verify using Try XPath then we can avoid this exception.
New Selenium IDE If an element is not found in an HTML DOM using xpath, then the NoSuchElementException is raised. This exception is thrown when the webdriver makes an attempt to locate a web element which is absent from DOM. This is normally encountered if we create an incorrect xpath for an element.
Expected Behavior -FindElements() functions should return an empty collection/null/NoSuchElementException if the element is not found found on a page.
You have to make an explicit check if an element is present before using this element in the next command (which might cause an error and break an execution of a script). User extension "sideflow" enables conditional jumps inside your code.
Here is home page of sideflow extension: https://github.com/darrenderidder/sideflow
With sideflow extension you may use code like this:
storeElementPresent id=btnRecSearch isPresent
gotoIf ${isPresent} == false End
click id=btnRecSearch
....
label End
This example is for the new Selenium IDE version 3 that works on Firefox and Chrome. The basic premise:
1) store xpath count -- this saves the count of elements that match to a variable
store xpath count | xpath=//body[@id='error-page'] | error
2) if -- in this case test the count is more than 0
if | ${error} > 0
3) do some magic stuff
4) end
end
Here is an article I posted using the same example: http://lance.bio/2018/12/21/selenium-ide-if-element-exists/
If you use all verify
related command then your script do not stop if element is not found by seleniun IDE but if you use assert
related command then your script is stop if that element is not found by selenium ide
If have to create your script using verifytext
command then run that script and see your script will not stop if element is not displayed
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With