What's the proper way to catch exceptions using the PHP Webdriver? I have something like this:
try {
// Throws a NoSuchElementException if id doesn't exist
$driver->findElement(WebDriverBy::id('loggedIn'));
return TRUE;
}
catch (NoSuchElementException $e) {
// id='loggedIn' doesn't exist
return FAlSE;
}
catch (Exception $e)
{
// Unknown exception
return FALSE;
}
However, when I reach a page and do not find the element with the id I'm looking for, I get the following error:
Uncaught Facebook\WebDriver\Exception\NoSuchElementException: Unable to locate element: #loggedIn
I'm not sure why as my code is wrapped in a try-catch block.