Skip to content

Commit

Permalink
Simplify window closing code upon session reset
Browse files Browse the repository at this point in the history
  • Loading branch information
aik099 committed Apr 9, 2024
1 parent da234b2 commit e58c490
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/WebdriverClassicDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,6 @@ public function reset(): void
{
$webDriver = $this->getWebDriver();

// Switch to default window.
$this->switchToWindow();

// Close all windows except the initial one.
foreach ($webDriver->getWindowHandles() as $windowHandle) {
if ($windowHandle === $this->initialWindowHandle) {
Expand All @@ -149,9 +146,9 @@ public function reset(): void

$webDriver->switchTo()->window($windowHandle);
$webDriver->close();
$this->switchToWindow();
}

$this->switchToWindow();
$webDriver->manage()->deleteAllCookies();
}

Expand Down

0 comments on commit e58c490

Please sign in to comment.