From 2fe6b36c5469026923be79c8a8054b1e8775d25f Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 18 Feb 2024 16:13:10 +0200 Subject: [PATCH] Improve "Selenium2Driver::applyTimeouts" error handling for Selenium 3 support --- src/Selenium2Driver.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Selenium2Driver.php b/src/Selenium2Driver.php index 05d6e321..fe05d327 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; @@ -370,6 +371,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); } }