Add the timeout in NoSuchElementException messages

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2017-04-15 14:53:28 +02:00
parent ff7d1bf1e7
commit a7e1833cf3
1 changed files with 8 additions and 1 deletions

View File

@ -139,7 +139,11 @@ class Actor {
return $element !== null;
};
if (!Utils::waitFor($findCallback, $timeout, $timeoutStep)) {
throw new NoSuchElementException($elementLocator->getDescription() . " could not be found");
$message = $elementLocator->getDescription() . " could not be found";
if ($timeout > 0) {
$message = $message . " after $timeout seconds";
}
throw new NoSuchElementException($message);
}
return $element;
@ -177,6 +181,9 @@ class Actor {
// exception in the chain.
$message = $exception->getMessage() . "\n" .
$elementLocator->getDescription() . " could not be found";
if ($timeout > 0) {
$message = $message . " after $timeout seconds";
}
throw new NoSuchElementException($message, $exception);
}
}