in reply to Re^5: Error Handling in Selenium
in thread Error Handling in Selenium

Hi 9mohit2,

In all your other posts you wrote that you were using find_element, which is documented to croak, but if you read further, the documentation says find_element_by_xpath does not croak. So you'll have to do the error handling yourself - I think $driver->find_element_by_xpath("abc") or die "Failed to find_element_by_xpath"; should cause your script to die (untested). Next time please read the documentation in more detail and post a code sample right away; up until now this thread was a wild goose chase.

Regards,
-- Hauke D

Replies are listed 'Best First'.
Re^7: Error Handling in Selenium
by 9mohit2 (Sexton) on Nov 22, 2016 at 06:59 UTC

    Hi Hauke,

    Firstly, the die workaround you suggested will not work as I have already tested it. Secondly, even if you change the find_element_by_xpath to find_element it is still not stopping the script execution nor throwing any error.Please suggest any method by which I can call a mail notification sub if any element is not found. Since I am using xpath I can use both find_element_by_xpath as well as find_element.

    Thanks for the help.