Skip to content

Commit

Permalink
Merge pull request #380 from aik099/selenium3-timeout-fix
Browse files Browse the repository at this point in the history
Improve "Selenium2Driver::applyTimeouts" error handling for Selenium 3 support
  • Loading branch information
aik099 authored Jun 28, 2024
2 parents a56db27 + 2fe6b36 commit 897e7d7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Selenium2Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 897e7d7

Please sign in to comment.