diff --git a/src/Selenium2Driver.php b/src/Selenium2Driver.php index f42ae402..3f2d1c39 100755 --- a/src/Selenium2Driver.php +++ b/src/Selenium2Driver.php @@ -14,6 +14,7 @@ use Behat\Mink\KeyModifier; use Behat\Mink\Selector\Xpath\Escaper; use WebDriver\Element; +use WebDriver\Exception\InvalidArgument; use WebDriver\Exception\NoSuchElement; use WebDriver\Exception\StaleElementReference; use WebDriver\Exception\UnknownCommand; @@ -372,6 +373,10 @@ private function applyTimeouts(): void $this->getWebDriverSession()->timeouts($type, $param); } } catch (UnknownError $e) { + // Selenium 2.x. + throw new DriverException('Error setting timeout: ' . $e->getMessage(), 0, $e); + } catch (InvalidArgument $e) { + // Selenium 3.x. throw new DriverException('Error setting timeout: ' . $e->getMessage(), 0, $e); } }