Skip to content

Commit 2fe6b36

Browse files
committed
Improve "Selenium2Driver::applyTimeouts" error handling for Selenium 3 support
1 parent 4ca4083 commit 2fe6b36

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/Selenium2Driver.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Behat\Mink\KeyModifier;
1515
use Behat\Mink\Selector\Xpath\Escaper;
1616
use WebDriver\Element;
17+
use WebDriver\Exception\InvalidArgument;
1718
use WebDriver\Exception\NoSuchElement;
1819
use WebDriver\Exception\StaleElementReference;
1920
use WebDriver\Exception\UnknownCommand;
@@ -370,6 +371,10 @@ private function applyTimeouts(): void
370371
$this->getWebDriverSession()->timeouts($type, $param);
371372
}
372373
} catch (UnknownError $e) {
374+
// Selenium 2.x.
375+
throw new DriverException('Error setting timeout: ' . $e->getMessage(), 0, $e);
376+
} catch (InvalidArgument $e) {
377+
// Selenium 3.x.
373378
throw new DriverException('Error setting timeout: ' . $e->getMessage(), 0, $e);
374379
}
375380
}

0 commit comments

Comments
 (0)