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

So I wanted a way so that the script stops execution
Then eval does more or less the opposite of what you want. Instead of
eval{$elem = $driver->find_element(".//*[\@id='nav']/li[3]/a");}
you could try
{ use warnings FATAL => 'all' $elem = $driver->find_element(".//*[\@id='nav']/li[3]/a"); }
However, that's just a guess, and the use of "fatal warnings" is controverse.