Skip to content

Commit

Permalink
Don't use empty window name for switching
Browse files Browse the repository at this point in the history
  • Loading branch information
aik099 committed Feb 23, 2024
1 parent 4ca4083 commit c48f0ef
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Selenium2Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,12 @@ public function back()

public function switchToWindow(?string $name = null)
{
$this->getWebDriverSession()->focusWindow($name ?: '');
if ($name === null) {
$handles = $this->getWindowNames();
$name = reset($handles);
}

$this->getWebDriverSession()->focusWindow($name);
}

public function switchToIFrame(?string $name = null)
Expand Down

0 comments on commit c48f0ef

Please sign in to comment.