class Window
WebDriver\Window class
@package WebDriver
@method array handles() Get window handles. @method array fullscreen() Fullscreen window. @method array maximize() Maximize the window if not already maximized. @method array minimize() Minimize window. @method array getPosition() Get position of the window. @method void postPosition($json) Change position of the window. @method array getRect() Get window rect. @method array postRect($json) Set window rect.
Hierarchy
- class \WebDriver\AbstractWebDriver
- class \WebDriver\Window extends \WebDriver\AbstractWebDriver
Expanded class hierarchy of Window
1 file declares its use of Window
- Selenium2Driver.php in vendor/
lullabot/ mink-selenium2-driver/ src/ Selenium2Driver.php
File
-
vendor/
lullabot/ php-webdriver/ lib/ WebDriver/ Window.php, line 28
Namespace
WebDriverView source
class Window extends AbstractWebDriver {
const WEB_WINDOW_ID = 'window-fcc6-11e5-b4f8-330a88ab9d7f';
/**
* @var string
*/
private $windowHandle;
/**
* {@inheritdoc}
*/
protected function methods() {
return array(
'handles' => array(
'GET',
),
'fullscreen' => array(
'POST',
),
'maximize' => array(
'POST',
),
'minimize' => array(
'POST',
),
'position' => array(
'GET',
'POST',
),
'rect' => array(
'GET',
'POST',
),
);
}
/**
* {@inheritdoc}
*/
protected function obsoleteMethods() {
return array(
// Legacy JSON Wire Protocol
'size' => array(
'GET',
'POST',
),
);
}
/**
* Constructor
*
* @param string $url
* @param string|null $windowHandle
*/
public function __construct($url, $windowHandle = null) {
parent::__construct($url);
$this->windowHandle = $windowHandle;
}
/**
* Get window handle: /session/:sessionId/window (GET)
* : /session/:sessionId/window_handle (GET)
* - $session->window($handle)->getHandle()
* - $session->window()->getHandle()
*
* @return string
*/
public function getHandle() {
if (!$this->windowHandle) {
$result = $this->curl('GET', $this->url);
$this->windowHandle = array_key_exists(self::WEB_WINDOW_ID, $result['value']) ? $result['value'][self::WEB_WINDOW_ID] : $result['value'];
}
return $this->windowHandle;
}
/**
* Close window: /session/:sessionId/window (DELETE)
*
* @return mixed
*/
public function close() {
$result = $this->curl('DELETE', '');
return $result['value'];
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
AbstractWebDriver::$curlService | private | property | Curl service | ||
AbstractWebDriver::$transientOptions | private | property | Transient options | ||
AbstractWebDriver::$url | protected | property | URL | ||
AbstractWebDriver::assertSerializable | private | function | Sanity check | ||
AbstractWebDriver::curl | protected | function | Curl request to webdriver server. | ||
AbstractWebDriver::getCurlService | public | function | Get curl service | ||
AbstractWebDriver::getRequestMethod | private | function | Get default HTTP request method for a given WebDriver command | ||
AbstractWebDriver::getTransientOptions | public | function | |||
AbstractWebDriver::getURL | public | function | Returns URL to Selenium server | ||
AbstractWebDriver::offsetGet | private | function | Extract value from result | ||
AbstractWebDriver::setCurlService | public | function | Set curl service | ||
AbstractWebDriver::setTransientOptions | public | function | Set transient options | ||
AbstractWebDriver::__call | public | function | Magic method that maps calls to class methods to execute WebDriver commands | 1 | |
AbstractWebDriver::__toString | public | function | Magic method which returns URL to Selenium server | ||
Window::$windowHandle | private | property | |||
Window::close | public | function | Close window: /session/:sessionId/window (DELETE) | ||
Window::getHandle | public | function | Get window handle: /session/:sessionId/window (GET) : /session/:sessionId/window_handle (GET) |
||
Window::methods | protected | function | Return array of supported method names and corresponding HTTP request methods | Overrides AbstractWebDriver::methods | |
Window::obsoleteMethods | protected | function | Return array of obsolete method names and corresponding HTTP request methods | Overrides AbstractWebDriver::obsoleteMethods | |
Window::WEB_WINDOW_ID | constant | ||||
Window::__construct | public | function | Constructor | Overrides AbstractWebDriver::__construct |