diff --git a/src/Selenium2Driver.php b/src/Selenium2Driver.php index 0795103d..987b5f54 100755 --- a/src/Selenium2Driver.php +++ b/src/Selenium2Driver.php @@ -453,11 +453,11 @@ public function back() public function switchToWindow(?string $name = null) { - $name = $name === null + $handle = $name === null ? $this->initialWindowHandle : $this->getWindowHandleFromName($name); - $this->getWebDriverSession()->focusWindow($name); + $this->getWebDriverSession()->focusWindow($handle); } /**