Codeception Tip - Close and Initialize Browser Session

Sometimes you may want to completely kill the browser session between tests since you need a completely clean new browser instance. You can do that with Codeception by writing a short helper method:

public function closeAndInitializeWebDriverSession() {
    $I = $this->getWebDriver();
    $I->_closeSession();
    $I->_initializeSession();
}

In your CEST you can put this e.g. in a _after method:

public function _after(WebDriverTester $I)
{
    $I->closeAndInitializeWebDriverSession();
}



Page 1 of 3, totaling 3 entries