We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 22e15dd commit 072a0b7Copy full SHA for 072a0b7
src/Codeception/Module/WebDriver.php
@@ -3454,9 +3454,12 @@ public function seeNumberOfTabs($number)
3454
*/
3455
public function closeTab()
3456
{
3457
+ $currentTab = $this->webDriver->getWindowHandle();
3458
$prevTab = $this->getRelativeTabHandle(-1);
3459
$this->webDriver->close();
- $this->webDriver->switchTo()->window($prevTab);
3460
+ if ($prevTab !== $currentTab) {
3461
+ $this->webDriver->switchTo()->window($prevTab);
3462
+ }
3463
}
3464
3465
/**
0 commit comments