Skip to content

Commit

Permalink
Catch LogicException when using not implemented getHistory introduced…
Browse files Browse the repository at this point in the history
… in symfony/panther 0.8
  • Loading branch information
robertfausk committed Oct 8, 2020
1 parent 56a86a3 commit ef04718
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/PantherDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class PantherDriver extends CoreDriver

// PantherTestCaseTrait needs this constants; provided via "\Symfony\Component\Panther\PantherTestCase"
public const CHROME = 'chrome';
public const FIREFOX = 'firefox';
public const FIREFOX = 'firefox';

/** @var Client */
private $client;
private $started = false;
Expand Down Expand Up @@ -140,9 +140,13 @@ public function reset()
$useSpeedUp = true;
if ($useSpeedUp) {
$this->client->getWebDriver()->manage()->deleteAllCookies();
$history = $this->client->getHistory();
if ($history) {
$history->clear();
try {
$history = $this->client->getHistory();
if ($history) {
$history->clear();
}
} catch (\LogicException $e) {
// History is not available when using e.g. WebDriver.
}
if (
$this->client->getWebDriver() instanceof JavaScriptExecutor
Expand Down

0 comments on commit ef04718

Please sign in to comment.