WindowTrait.php in Zircon Profile 8.0
File
vendor/jcalderonzumba/mink-phantomjs-driver/src/WindowTrait.php
View source
<?php
namespace Zumba\Mink\Driver;
use Behat\Mink\Exception\DriverException;
trait WindowTrait {
public function getWindowName() {
return $this->browser
->windowName();
}
public function getWindowNames() {
return $this->browser
->windowHandles();
}
public function switchToWindow($name = null) {
$handles = $this->browser
->windowHandles();
if ($name === null) {
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}");
}
}
public function resizeWindow($width, $height, $name = null) {
if ($name !== null) {
throw new DriverException("Resizing other window than the main one is not supported yet");
}
$this->browser
->resize($width, $height);
}
}