3 namespace Zumba\Mink\Driver;
5 use Behat\Mink\Exception\DriverException;
9 * @package Zumba\Mink\Driver
13 * Returns the current page window name
16 public function getWindowName() {
17 return $this->browser->windowName();
21 * Return all the window handles currently present in phantomjs
24 public function getWindowNames() {
25 return $this->browser->windowHandles();
29 * Switches to window by name if possible
31 * @throws DriverException
33 public function switchToWindow($name = null) {
34 $handles = $this->browser->windowHandles();
36 //null means back to the main window
37 return $this->browser->switchToWindow($handles[0]);
40 $windowHandle = $this->browser->windowHandle($name);
41 if (!empty($windowHandle)) {
42 $this->browser->switchToWindow($windowHandle);
44 throw new DriverException("Could not find window handle by a given window name: $name");
50 * Resizing a window with specified size
54 * @throws DriverException
56 public function resizeWindow($width, $height, $name = null) {
58 //TODO: add this on the phantomjs stuff
59 throw new DriverException("Resizing other window than the main one is not supported yet");
61 $this->browser->resize($width, $height);