public function WindowTrait::switchToWindow in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/jcalderonzumba/mink-phantomjs-driver/src/WindowTrait.php \Zumba\Mink\Driver\WindowTrait::switchToWindow()
Switches to window by name if possible
Parameters
$name:
Throws
File
- vendor/
jcalderonzumba/ mink-phantomjs-driver/ src/ WindowTrait.php, line 33
Class
- WindowTrait
- Class WindowTrait @package Zumba\Mink\Driver
Namespace
Zumba\Mink\DriverCode
public function switchToWindow($name = null) {
$handles = $this->browser
->windowHandles();
if ($name === null) {
//null means back to the main window
return $this->browser
->switchToWindow($handles[0]);
}
$windowHandle = $this->browser
->windowHandle($name);
if (!empty($windowHandle)) {
$this->browser
->switchToWindow($windowHandle);
}
else {
throw new DriverException("Could not find window handle by a given window name: {$name}");
}
}