diff --git a/src/Codeception/Lib/InnerBrowser.php b/src/Codeception/Lib/InnerBrowser.php index f0c52e5..a1f8bca 100644 --- a/src/Codeception/Lib/InnerBrowser.php +++ b/src/Codeception/Lib/InnerBrowser.php @@ -600,7 +600,11 @@ public function dontSeeLink($text, $url = '') */ public function _getCurrentUri() { - return Uri::retrieveUri($this->getRunningClient()->getHistory()->current()->getUri()); + try { + return Uri::retrieveUri($this->getRunningClient()->getHistory()->current()->getUri()); + } catch (\LogicException $e) { + throw new \LogicException($e->getMessage() . ' Call `$I->amOnPage()` first.'); + } } public function seeInCurrentUrl($uri)