From ef04718c3c5406c75218a2dc5c51f888264dc692 Mon Sep 17 00:00:00 2001 From: robertfausk Date: Thu, 8 Oct 2020 17:24:47 +0200 Subject: [PATCH] Catch LogicException when using not implemented getHistory introduced in symfony/panther 0.8 --- src/PantherDriver.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/PantherDriver.php b/src/PantherDriver.php index ca559fb..0566bc8 100644 --- a/src/PantherDriver.php +++ b/src/PantherDriver.php @@ -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; @@ -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