function Selenium2Driver::switchToWindow
Overrides CoreDriver::switchToWindow
1 call to Selenium2Driver::switchToWindow()
- Selenium2Driver::reset in vendor/
lullabot/ mink-selenium2-driver/ src/ Selenium2Driver.php - Resets driver state.
File
-
vendor/
lullabot/ mink-selenium2-driver/ src/ Selenium2Driver.php, line 465
Class
- Selenium2Driver
- Selenium2 driver.
Namespace
Behat\Mink\DriverCode
public function switchToWindow(?string $name = null) {
if ($this->isW3C()) {
$allHandles = $this->getWebDriverSession()
->getWindowHandles();
foreach ($allHandles as $handle) {
$script = <<<JS
return window.name;
JS;
$this->getWebDriverSession()
->focusWindow($handle);
$windowName = $this->getWebDriverSession()
->execute(array(
'script' => $script,
'args' => array(),
));
if ($windowName === $name || empty($name) && empty($windowName)) {
break;
}
}
}
else {
$this->getWebDriverSession()
->focusWindow($name ?: '');
}
}