Skip to content

Commit

Permalink
Fix switchToWindow for Selenium 3.x and Firefox (Chrome is always ok)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Oct 23, 2022
1 parent 87e6203 commit 3d1c8d1
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 @@ -415,7 +415,12 @@ public function back()
*/
public function switchToWindow($name = null)
{
$this->wdSession->focusWindow($name ?: '');
if ($name === null) {
$handles = $this->wdSession->window_handles();
$name = reset($handles);
}

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

/**
Expand Down

0 comments on commit 3d1c8d1

Please sign in to comment.