Laravel version update
Laravel version update
This commit is contained in:
101
vendor/facebook/webdriver/lib/Chrome/ChromeDriver.php
vendored
Normal file
101
vendor/facebook/webdriver/lib/Chrome/ChromeDriver.php
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Chrome;
|
||||
|
||||
use Facebook\WebDriver\Exception\WebDriverException;
|
||||
use Facebook\WebDriver\Remote\DesiredCapabilities;
|
||||
use Facebook\WebDriver\Remote\DriverCommand;
|
||||
use Facebook\WebDriver\Remote\RemoteWebDriver;
|
||||
use Facebook\WebDriver\Remote\Service\DriverCommandExecutor;
|
||||
use Facebook\WebDriver\Remote\WebDriverCommand;
|
||||
|
||||
class ChromeDriver extends RemoteWebDriver
|
||||
{
|
||||
/**
|
||||
* @return static
|
||||
*/
|
||||
public static function start(DesiredCapabilities $desired_capabilities = null, ChromeDriverService $service = null)
|
||||
{
|
||||
if ($desired_capabilities === null) {
|
||||
$desired_capabilities = DesiredCapabilities::chrome();
|
||||
}
|
||||
if ($service === null) {
|
||||
$service = ChromeDriverService::createDefaultService();
|
||||
}
|
||||
$executor = new DriverCommandExecutor($service);
|
||||
$driver = new static($executor, null, $desired_capabilities);
|
||||
$driver->startSession($desired_capabilities);
|
||||
|
||||
return $driver;
|
||||
}
|
||||
|
||||
public function startSession(DesiredCapabilities $desired_capabilities)
|
||||
{
|
||||
$command = new WebDriverCommand(
|
||||
null,
|
||||
DriverCommand::NEW_SESSION,
|
||||
[
|
||||
'desiredCapabilities' => $desired_capabilities->toArray(),
|
||||
]
|
||||
);
|
||||
$response = $this->executor->execute($command);
|
||||
$this->sessionID = $response->getSessionID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Always throws an exception. Use ChromeDriver::start() instead.
|
||||
*
|
||||
* @param string $selenium_server_url
|
||||
* @param DesiredCapabilities|array $desired_capabilities
|
||||
* @param int|null $connection_timeout_in_ms
|
||||
* @param int|null $request_timeout_in_ms
|
||||
* @param string|null $http_proxy
|
||||
* @param int|null $http_proxy_port
|
||||
* @param DesiredCapabilities $required_capabilities
|
||||
* @throws WebDriverException
|
||||
* @return RemoteWebDriver
|
||||
*/
|
||||
public static function create(
|
||||
$selenium_server_url = 'http://localhost:4444/wd/hub',
|
||||
$desired_capabilities = null,
|
||||
$connection_timeout_in_ms = null,
|
||||
$request_timeout_in_ms = null,
|
||||
$http_proxy = null,
|
||||
$http_proxy_port = null,
|
||||
DesiredCapabilities $required_capabilities = null
|
||||
) {
|
||||
throw new WebDriverException('Please use ChromeDriver::start() instead.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Always throws an exception. Use ChromeDriver::start() instead.
|
||||
*
|
||||
* @param string $session_id The existing session id
|
||||
* @param string $selenium_server_url The url of the remote Selenium WebDriver server
|
||||
* @param int|null $connection_timeout_in_ms Set timeout for the connect phase to remote Selenium WebDriver server
|
||||
* @param int|null $request_timeout_in_ms Set the maximum time of a request to remote Selenium WebDriver server
|
||||
* @throws WebDriverException
|
||||
* @return RemoteWebDriver|void
|
||||
*/
|
||||
public static function createBySessionID(
|
||||
$session_id,
|
||||
$selenium_server_url = 'http://localhost:4444/wd/hub',
|
||||
$connection_timeout_in_ms = null,
|
||||
$request_timeout_in_ms = null
|
||||
) {
|
||||
throw new WebDriverException('Please use ChromeDriver::start() instead.');
|
||||
}
|
||||
}
|
||||
37
vendor/facebook/webdriver/lib/Chrome/ChromeDriverService.php
vendored
Normal file
37
vendor/facebook/webdriver/lib/Chrome/ChromeDriverService.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Chrome;
|
||||
|
||||
use Facebook\WebDriver\Remote\Service\DriverService;
|
||||
|
||||
class ChromeDriverService extends DriverService
|
||||
{
|
||||
// The environment variable storing the path to the chrome driver executable.
|
||||
const CHROME_DRIVER_EXE_PROPERTY = 'webdriver.chrome.driver';
|
||||
|
||||
/**
|
||||
* @return static
|
||||
*/
|
||||
public static function createDefaultService()
|
||||
{
|
||||
$exe = getenv(self::CHROME_DRIVER_EXE_PROPERTY);
|
||||
$port = 9515; // TODO: Get another port if the default port is used.
|
||||
$args = ["--port=$port"];
|
||||
$service = new static($exe, $port, $args);
|
||||
|
||||
return $service;
|
||||
}
|
||||
}
|
||||
175
vendor/facebook/webdriver/lib/Chrome/ChromeOptions.php
vendored
Normal file
175
vendor/facebook/webdriver/lib/Chrome/ChromeOptions.php
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Chrome;
|
||||
|
||||
use Facebook\WebDriver\Remote\DesiredCapabilities;
|
||||
|
||||
/**
|
||||
* The class manages the capabilities in ChromeDriver.
|
||||
*
|
||||
* @see https://sites.google.com/a/chromium.org/chromedriver/capabilities
|
||||
*/
|
||||
class ChromeOptions
|
||||
{
|
||||
/**
|
||||
* The key of chrome options in desired capabilities.
|
||||
*/
|
||||
const CAPABILITY = 'chromeOptions';
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $arguments = [];
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $binary = '';
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $extensions = [];
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $experimentalOptions = [];
|
||||
|
||||
/**
|
||||
* Sets the path of the Chrome executable. The path should be either absolute
|
||||
* or relative to the location running ChromeDriver server.
|
||||
*
|
||||
* @param string $path
|
||||
* @return ChromeOptions
|
||||
*/
|
||||
public function setBinary($path)
|
||||
{
|
||||
$this->binary = $path;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $arguments
|
||||
* @return ChromeOptions
|
||||
*/
|
||||
public function addArguments(array $arguments)
|
||||
{
|
||||
$this->arguments = array_merge($this->arguments, $arguments);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Chrome extension to install on browser startup. Each path should be
|
||||
* a packed Chrome extension.
|
||||
*
|
||||
* @param array $paths
|
||||
* @return ChromeOptions
|
||||
*/
|
||||
public function addExtensions(array $paths)
|
||||
{
|
||||
foreach ($paths as $path) {
|
||||
$this->addExtension($path);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $encoded_extensions An array of base64 encoded of the extensions.
|
||||
* @return ChromeOptions
|
||||
*/
|
||||
public function addEncodedExtensions(array $encoded_extensions)
|
||||
{
|
||||
foreach ($encoded_extensions as $encoded_extension) {
|
||||
$this->addEncodedExtension($encoded_extension);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an experimental option which has not exposed officially.
|
||||
*
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @return ChromeOptions
|
||||
*/
|
||||
public function setExperimentalOption($name, $value)
|
||||
{
|
||||
$this->experimentalOptions[$name] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DesiredCapabilities The DesiredCapabilities for Chrome with this options.
|
||||
*/
|
||||
public function toCapabilities()
|
||||
{
|
||||
$capabilities = DesiredCapabilities::chrome();
|
||||
$capabilities->setCapability(self::CAPABILITY, $this);
|
||||
|
||||
return $capabilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
$options = $this->experimentalOptions;
|
||||
|
||||
// The selenium server expects a 'dictionary' instead of a 'list' when
|
||||
// reading the chrome option. However, an empty array in PHP will be
|
||||
// converted to a 'list' instead of a 'dictionary'. To fix it, we always
|
||||
// set the 'binary' to avoid returning an empty array.
|
||||
$options['binary'] = $this->binary;
|
||||
|
||||
if ($this->arguments) {
|
||||
$options['args'] = $this->arguments;
|
||||
}
|
||||
|
||||
if ($this->extensions) {
|
||||
$options['extensions'] = $this->extensions;
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Chrome extension to install on browser startup. Each path should be a
|
||||
* packed Chrome extension.
|
||||
*
|
||||
* @param string $path
|
||||
* @return ChromeOptions
|
||||
*/
|
||||
private function addExtension($path)
|
||||
{
|
||||
$this->addEncodedExtension(base64_encode(file_get_contents($path)));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $encoded_extension Base64 encoded of the extension.
|
||||
* @return ChromeOptions
|
||||
*/
|
||||
private function addEncodedExtension($encoded_extension)
|
||||
{
|
||||
$this->extensions[] = $encoded_extension;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
241
vendor/facebook/webdriver/lib/Cookie.php
vendored
Normal file
241
vendor/facebook/webdriver/lib/Cookie.php
vendored
Normal file
@@ -0,0 +1,241 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Set values of an cookie.
|
||||
*
|
||||
* Implements ArrayAccess for backwards compatibility.
|
||||
*
|
||||
* @see https://w3c.github.io/webdriver/webdriver-spec.html#cookies
|
||||
*/
|
||||
class Cookie implements \ArrayAccess
|
||||
{
|
||||
/** @var array */
|
||||
protected $cookie = [
|
||||
'name' => null,
|
||||
'value' => null,
|
||||
'path' => null,
|
||||
'domain' => null,
|
||||
'expiry' => null,
|
||||
'secure' => null,
|
||||
'httpOnly' => null,
|
||||
];
|
||||
|
||||
/**
|
||||
* @param string $name The name of the cookie; may not be null or an empty string.
|
||||
* @param string $value The cookie value; may not be null.
|
||||
*/
|
||||
public function __construct($name, $value)
|
||||
{
|
||||
$this->validateCookieName($name);
|
||||
$this->validateCookieValue($value);
|
||||
|
||||
$this->cookie['name'] = $name;
|
||||
$this->cookie['value'] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $cookieArray
|
||||
* @return Cookie
|
||||
*/
|
||||
public static function createFromArray(array $cookieArray)
|
||||
{
|
||||
$cookie = new self($cookieArray['name'], $cookieArray['value']);
|
||||
|
||||
if (isset($cookieArray['path'])) {
|
||||
$cookie->setPath($cookieArray['path']);
|
||||
}
|
||||
if (isset($cookieArray['domain'])) {
|
||||
$cookie->setDomain($cookieArray['domain']);
|
||||
}
|
||||
if (isset($cookieArray['expiry'])) {
|
||||
$cookie->setExpiry($cookieArray['expiry']);
|
||||
}
|
||||
if (isset($cookieArray['secure'])) {
|
||||
$cookie->setSecure($cookieArray['secure']);
|
||||
}
|
||||
if (isset($cookieArray['httpOnly'])) {
|
||||
$cookie->setHttpOnly($cookieArray['httpOnly']);
|
||||
}
|
||||
|
||||
return $cookie;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->cookie['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->cookie['value'];
|
||||
}
|
||||
|
||||
/**
|
||||
* The path the cookie is visible to. Defaults to "/" if omitted.
|
||||
*
|
||||
* @param string $path
|
||||
*/
|
||||
public function setPath($path)
|
||||
{
|
||||
$this->cookie['path'] = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPath()
|
||||
{
|
||||
return $this->cookie['path'];
|
||||
}
|
||||
|
||||
/**
|
||||
* The domain the cookie is visible to. Defaults to the current browsing context's document's URL domain if omitted.
|
||||
*
|
||||
* @param string $domain
|
||||
*/
|
||||
public function setDomain($domain)
|
||||
{
|
||||
if (mb_strpos($domain, ':') !== false) {
|
||||
throw new InvalidArgumentException(sprintf('Cookie domain "%s" should not contain a port', $domain));
|
||||
}
|
||||
|
||||
$this->cookie['domain'] = $domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getDomain()
|
||||
{
|
||||
return $this->cookie['domain'];
|
||||
}
|
||||
|
||||
/**
|
||||
* The cookie's expiration date, specified in seconds since Unix Epoch.
|
||||
*
|
||||
* @param int $expiry
|
||||
*/
|
||||
public function setExpiry($expiry)
|
||||
{
|
||||
$this->cookie['expiry'] = (int) $expiry;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getExpiry()
|
||||
{
|
||||
return $this->cookie['expiry'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this cookie requires a secure connection (https). Defaults to false if omitted.
|
||||
*
|
||||
* @param bool $secure
|
||||
*/
|
||||
public function setSecure($secure)
|
||||
{
|
||||
$this->cookie['secure'] = $secure;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|null
|
||||
*/
|
||||
public function isSecure()
|
||||
{
|
||||
return $this->cookie['secure'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the cookie is an HTTP only cookie. Defaults to false if omitted.
|
||||
*
|
||||
* @param bool $httpOnly
|
||||
*/
|
||||
public function setHttpOnly($httpOnly)
|
||||
{
|
||||
$this->cookie['httpOnly'] = $httpOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|null
|
||||
*/
|
||||
public function isHttpOnly()
|
||||
{
|
||||
return $this->cookie['httpOnly'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
return $this->cookie;
|
||||
}
|
||||
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->cookie[$offset]);
|
||||
}
|
||||
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->cookie[$offset];
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
$this->cookie[$offset] = $value;
|
||||
}
|
||||
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
unset($this->cookie[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
protected function validateCookieName($name)
|
||||
{
|
||||
if ($name === null || $name === '') {
|
||||
throw new InvalidArgumentException('Cookie name should be non-empty');
|
||||
}
|
||||
|
||||
if (mb_strpos($name, ';') !== false) {
|
||||
throw new InvalidArgumentException('Cookie name should not contain a ";"');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
protected function validateCookieValue($value)
|
||||
{
|
||||
if ($value === null) {
|
||||
throw new InvalidArgumentException('Cookie value is required when setting a cookie');
|
||||
}
|
||||
}
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/ElementNotSelectableException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/ElementNotSelectableException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class ElementNotSelectableException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/ElementNotVisibleException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/ElementNotVisibleException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class ElementNotVisibleException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/ExpectedException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/ExpectedException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class ExpectedException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/IMEEngineActivationFailedException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/IMEEngineActivationFailedException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class IMEEngineActivationFailedException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/IMENotAvailableException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/IMENotAvailableException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class IMENotAvailableException extends WebDriverException
|
||||
{
|
||||
}
|
||||
7
vendor/facebook/webdriver/lib/Exception/IndexOutOfBoundsException.php
vendored
Normal file
7
vendor/facebook/webdriver/lib/Exception/IndexOutOfBoundsException.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class IndexOutOfBoundsException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/InvalidCookieDomainException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/InvalidCookieDomainException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class InvalidCookieDomainException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/InvalidCoordinatesException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/InvalidCoordinatesException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class InvalidCoordinatesException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/InvalidElementStateException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/InvalidElementStateException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class InvalidElementStateException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/InvalidSelectorException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/InvalidSelectorException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class InvalidSelectorException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/MoveTargetOutOfBoundsException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/MoveTargetOutOfBoundsException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class MoveTargetOutOfBoundsException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/NoAlertOpenException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/NoAlertOpenException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class NoAlertOpenException extends WebDriverException
|
||||
{
|
||||
}
|
||||
7
vendor/facebook/webdriver/lib/Exception/NoCollectionException.php
vendored
Normal file
7
vendor/facebook/webdriver/lib/Exception/NoCollectionException.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class NoCollectionException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/NoScriptResultException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/NoScriptResultException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class NoScriptResultException extends WebDriverException
|
||||
{
|
||||
}
|
||||
7
vendor/facebook/webdriver/lib/Exception/NoStringException.php
vendored
Normal file
7
vendor/facebook/webdriver/lib/Exception/NoStringException.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class NoStringException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/NoStringLengthException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/NoStringLengthException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class NoStringLengthException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/NoStringWrapperException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/NoStringWrapperException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class NoStringWrapperException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/NoSuchCollectionException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/NoSuchCollectionException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class NoSuchCollectionException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/NoSuchDocumentException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/NoSuchDocumentException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class NoSuchDocumentException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/NoSuchDriverException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/NoSuchDriverException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class NoSuchDriverException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/NoSuchElementException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/NoSuchElementException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class NoSuchElementException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/NoSuchFrameException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/NoSuchFrameException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class NoSuchFrameException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/NoSuchWindowException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/NoSuchWindowException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class NoSuchWindowException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/NullPointerException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/NullPointerException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class NullPointerException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/ScriptTimeoutException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/ScriptTimeoutException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class ScriptTimeoutException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/SessionNotCreatedException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/SessionNotCreatedException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class SessionNotCreatedException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/StaleElementReferenceException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/StaleElementReferenceException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class StaleElementReferenceException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/TimeOutException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/TimeOutException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class TimeOutException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/UnableToSetCookieException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/UnableToSetCookieException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class UnableToSetCookieException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/UnexpectedAlertOpenException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/UnexpectedAlertOpenException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class UnexpectedAlertOpenException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/UnexpectedJavascriptException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/UnexpectedJavascriptException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class UnexpectedJavascriptException extends WebDriverException
|
||||
{
|
||||
}
|
||||
36
vendor/facebook/webdriver/lib/Exception/UnexpectedTagNameException.php
vendored
Normal file
36
vendor/facebook/webdriver/lib/Exception/UnexpectedTagNameException.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class UnexpectedTagNameException extends WebDriverException
|
||||
{
|
||||
/**
|
||||
* @param string $expected_tag_name
|
||||
* @param string $actual_tag_name
|
||||
*/
|
||||
public function __construct(
|
||||
$expected_tag_name,
|
||||
$actual_tag_name
|
||||
) {
|
||||
parent::__construct(
|
||||
sprintf(
|
||||
'Element should have been "%s" but was "%s"',
|
||||
$expected_tag_name,
|
||||
$actual_tag_name
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/UnknownCommandException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/UnknownCommandException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class UnknownCommandException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/UnknownServerException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/UnknownServerException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class UnknownServerException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/UnrecognizedExceptionException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/UnrecognizedExceptionException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class UnrecognizedExceptionException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/UnsupportedOperationException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/UnsupportedOperationException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class UnsupportedOperationException extends WebDriverException
|
||||
{
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/WebDriverCurlException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/WebDriverCurlException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class WebDriverCurlException extends WebDriverException
|
||||
{
|
||||
}
|
||||
161
vendor/facebook/webdriver/lib/Exception/WebDriverException.php
vendored
Normal file
161
vendor/facebook/webdriver/lib/Exception/WebDriverException.php
vendored
Normal file
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
use Exception;
|
||||
|
||||
class WebDriverException extends Exception
|
||||
{
|
||||
private $results;
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
* @param mixed $results
|
||||
*/
|
||||
public function __construct($message, $results = null)
|
||||
{
|
||||
parent::__construct($message);
|
||||
$this->results = $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getResults()
|
||||
{
|
||||
return $this->results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Throw WebDriverExceptions based on WebDriver status code.
|
||||
*
|
||||
* @param int $status_code
|
||||
* @param string $message
|
||||
* @param mixed $results
|
||||
*
|
||||
* @throws ElementNotSelectableException
|
||||
* @throws ElementNotVisibleException
|
||||
* @throws ExpectedException
|
||||
* @throws IMEEngineActivationFailedException
|
||||
* @throws IMENotAvailableException
|
||||
* @throws IndexOutOfBoundsException
|
||||
* @throws InvalidCookieDomainException
|
||||
* @throws InvalidCoordinatesException
|
||||
* @throws InvalidElementStateException
|
||||
* @throws InvalidSelectorException
|
||||
* @throws MoveTargetOutOfBoundsException
|
||||
* @throws NoAlertOpenException
|
||||
* @throws NoCollectionException
|
||||
* @throws NoScriptResultException
|
||||
* @throws NoStringException
|
||||
* @throws NoStringLengthException
|
||||
* @throws NoStringWrapperException
|
||||
* @throws NoSuchCollectionException
|
||||
* @throws NoSuchDocumentException
|
||||
* @throws NoSuchDriverException
|
||||
* @throws NoSuchElementException
|
||||
* @throws NoSuchFrameException
|
||||
* @throws NoSuchWindowException
|
||||
* @throws NullPointerException
|
||||
* @throws ScriptTimeoutException
|
||||
* @throws SessionNotCreatedException
|
||||
* @throws StaleElementReferenceException
|
||||
* @throws TimeOutException
|
||||
* @throws UnableToSetCookieException
|
||||
* @throws UnexpectedAlertOpenException
|
||||
* @throws UnexpectedJavascriptException
|
||||
* @throws UnknownCommandException
|
||||
* @throws UnknownServerException
|
||||
* @throws UnrecognizedExceptionException
|
||||
* @throws WebDriverCurlException
|
||||
* @throws XPathLookupException
|
||||
*/
|
||||
public static function throwException($status_code, $message, $results)
|
||||
{
|
||||
switch ($status_code) {
|
||||
case 1:
|
||||
throw new IndexOutOfBoundsException($message, $results);
|
||||
case 2:
|
||||
throw new NoCollectionException($message, $results);
|
||||
case 3:
|
||||
throw new NoStringException($message, $results);
|
||||
case 4:
|
||||
throw new NoStringLengthException($message, $results);
|
||||
case 5:
|
||||
throw new NoStringWrapperException($message, $results);
|
||||
case 6:
|
||||
throw new NoSuchDriverException($message, $results);
|
||||
case 7:
|
||||
throw new NoSuchElementException($message, $results);
|
||||
case 8:
|
||||
throw new NoSuchFrameException($message, $results);
|
||||
case 9:
|
||||
throw new UnknownCommandException($message, $results);
|
||||
case 10:
|
||||
throw new StaleElementReferenceException($message, $results);
|
||||
case 11:
|
||||
throw new ElementNotVisibleException($message, $results);
|
||||
case 12:
|
||||
throw new InvalidElementStateException($message, $results);
|
||||
case 13:
|
||||
throw new UnknownServerException($message, $results);
|
||||
case 14:
|
||||
throw new ExpectedException($message, $results);
|
||||
case 15:
|
||||
throw new ElementNotSelectableException($message, $results);
|
||||
case 16:
|
||||
throw new NoSuchDocumentException($message, $results);
|
||||
case 17:
|
||||
throw new UnexpectedJavascriptException($message, $results);
|
||||
case 18:
|
||||
throw new NoScriptResultException($message, $results);
|
||||
case 19:
|
||||
throw new XPathLookupException($message, $results);
|
||||
case 20:
|
||||
throw new NoSuchCollectionException($message, $results);
|
||||
case 21:
|
||||
throw new TimeOutException($message, $results);
|
||||
case 22:
|
||||
throw new NullPointerException($message, $results);
|
||||
case 23:
|
||||
throw new NoSuchWindowException($message, $results);
|
||||
case 24:
|
||||
throw new InvalidCookieDomainException($message, $results);
|
||||
case 25:
|
||||
throw new UnableToSetCookieException($message, $results);
|
||||
case 26:
|
||||
throw new UnexpectedAlertOpenException($message, $results);
|
||||
case 27:
|
||||
throw new NoAlertOpenException($message, $results);
|
||||
case 28:
|
||||
throw new ScriptTimeoutException($message, $results);
|
||||
case 29:
|
||||
throw new InvalidCoordinatesException($message, $results);
|
||||
case 30:
|
||||
throw new IMENotAvailableException($message, $results);
|
||||
case 31:
|
||||
throw new IMEEngineActivationFailedException($message, $results);
|
||||
case 32:
|
||||
throw new InvalidSelectorException($message, $results);
|
||||
case 33:
|
||||
throw new SessionNotCreatedException($message, $results);
|
||||
case 34:
|
||||
throw new MoveTargetOutOfBoundsException($message, $results);
|
||||
default:
|
||||
throw new UnrecognizedExceptionException($message, $results);
|
||||
}
|
||||
}
|
||||
}
|
||||
20
vendor/facebook/webdriver/lib/Exception/XPathLookupException.php
vendored
Normal file
20
vendor/facebook/webdriver/lib/Exception/XPathLookupException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Exception;
|
||||
|
||||
class XPathLookupException extends WebDriverException
|
||||
{
|
||||
}
|
||||
28
vendor/facebook/webdriver/lib/Firefox/FirefoxDriver.php
vendored
Normal file
28
vendor/facebook/webdriver/lib/Firefox/FirefoxDriver.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Firefox;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class FirefoxDriver
|
||||
{
|
||||
const PROFILE = 'firefox_profile';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
}
|
||||
36
vendor/facebook/webdriver/lib/Firefox/FirefoxPreferences.php
vendored
Normal file
36
vendor/facebook/webdriver/lib/Firefox/FirefoxPreferences.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Firefox;
|
||||
|
||||
/**
|
||||
* Constants of common Firefox profile preferences (about:config values).
|
||||
* @see http://kb.mozillazine.org/Firefox_:_FAQs_:_About:config_Entries
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class FirefoxPreferences
|
||||
{
|
||||
/** @var string Port WebDriver uses to communicate with Firefox instance */
|
||||
const WEBDRIVER_FIREFOX_PORT = 'webdriver_firefox_port';
|
||||
/** @var string Should the reader view (FF 38+) be enabled? */
|
||||
const READER_PARSE_ON_LOAD_ENABLED = 'reader.parse-on-load.enabled';
|
||||
/** @var string Browser homepage */
|
||||
const BROWSER_STARTUP_HOMEPAGE = 'browser.startup.homepage';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
}
|
||||
302
vendor/facebook/webdriver/lib/Firefox/FirefoxProfile.php
vendored
Normal file
302
vendor/facebook/webdriver/lib/Firefox/FirefoxProfile.php
vendored
Normal file
@@ -0,0 +1,302 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Firefox;
|
||||
|
||||
use Facebook\WebDriver\Exception\WebDriverException;
|
||||
use FilesystemIterator;
|
||||
use RecursiveDirectoryIterator;
|
||||
use RecursiveIteratorIterator;
|
||||
use ZipArchive;
|
||||
|
||||
class FirefoxProfile
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $preferences = [];
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $extensions = [];
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $extensions_datas = [];
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $rdf_file;
|
||||
|
||||
/**
|
||||
* @param string $extension The path to the xpi extension.
|
||||
* @return FirefoxProfile
|
||||
*/
|
||||
public function addExtension($extension)
|
||||
{
|
||||
$this->extensions[] = $extension;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $extension_datas The path to the folder containing the datas to add to the extension
|
||||
* @return FirefoxProfile
|
||||
*/
|
||||
public function addExtensionDatas($extension_datas)
|
||||
{
|
||||
if (!is_dir($extension_datas)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->extensions_datas[basename($extension_datas)] = $extension_datas;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $rdf_file The path to the rdf file
|
||||
* @return FirefoxProfile
|
||||
*/
|
||||
public function setRdfFile($rdf_file)
|
||||
{
|
||||
if (!is_file($rdf_file)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->rdf_file = $rdf_file;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param string|bool|int $value
|
||||
* @throws WebDriverException
|
||||
* @return FirefoxProfile
|
||||
*/
|
||||
public function setPreference($key, $value)
|
||||
{
|
||||
if (is_string($value)) {
|
||||
$value = sprintf('"%s"', $value);
|
||||
} else {
|
||||
if (is_int($value)) {
|
||||
$value = sprintf('%d', $value);
|
||||
} else {
|
||||
if (is_bool($value)) {
|
||||
$value = $value ? 'true' : 'false';
|
||||
} else {
|
||||
throw new WebDriverException(
|
||||
'The value of the preference should be either a string, int or bool.'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->preferences[$key] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function getPreference($key)
|
||||
{
|
||||
if (array_key_exists($key, $this->preferences)) {
|
||||
return $this->preferences[$key];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function encode()
|
||||
{
|
||||
$temp_dir = $this->createTempDirectory('WebDriverFirefoxProfile');
|
||||
|
||||
if (isset($this->rdf_file)) {
|
||||
copy($this->rdf_file, $temp_dir . DIRECTORY_SEPARATOR . 'mimeTypes.rdf');
|
||||
}
|
||||
|
||||
foreach ($this->extensions as $extension) {
|
||||
$this->installExtension($extension, $temp_dir);
|
||||
}
|
||||
|
||||
foreach ($this->extensions_datas as $dirname => $extension_datas) {
|
||||
mkdir($temp_dir . DIRECTORY_SEPARATOR . $dirname);
|
||||
$iterator = new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator($extension_datas, RecursiveDirectoryIterator::SKIP_DOTS),
|
||||
RecursiveIteratorIterator::SELF_FIRST
|
||||
);
|
||||
foreach ($iterator as $item) {
|
||||
$target_dir = $temp_dir . DIRECTORY_SEPARATOR . $dirname . DIRECTORY_SEPARATOR
|
||||
. $iterator->getSubPathName();
|
||||
|
||||
if ($item->isDir()) {
|
||||
mkdir($target_dir);
|
||||
} else {
|
||||
copy($item, $target_dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$content = '';
|
||||
foreach ($this->preferences as $key => $value) {
|
||||
$content .= sprintf("user_pref(\"%s\", %s);\n", $key, $value);
|
||||
}
|
||||
file_put_contents($temp_dir . '/user.js', $content);
|
||||
|
||||
$zip = new ZipArchive();
|
||||
$temp_zip = tempnam(sys_get_temp_dir(), 'WebDriverFirefoxProfileZip');
|
||||
$zip->open($temp_zip, ZipArchive::CREATE);
|
||||
|
||||
$dir = new RecursiveDirectoryIterator($temp_dir);
|
||||
$files = new RecursiveIteratorIterator($dir);
|
||||
|
||||
$dir_prefix = preg_replace(
|
||||
'#\\\\#',
|
||||
'\\\\\\\\',
|
||||
$temp_dir . DIRECTORY_SEPARATOR
|
||||
);
|
||||
|
||||
foreach ($files as $name => $object) {
|
||||
if (is_dir($name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$path = preg_replace("#^{$dir_prefix}#", '', $name);
|
||||
$zip->addFile($name, $path);
|
||||
}
|
||||
$zip->close();
|
||||
|
||||
$profile = base64_encode(file_get_contents($temp_zip));
|
||||
|
||||
// clean up
|
||||
$this->deleteDirectory($temp_dir);
|
||||
unlink($temp_zip);
|
||||
|
||||
return $profile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $extension The path to the extension.
|
||||
* @param string $profile_dir The path to the profile directory.
|
||||
* @return string The path to the directory of this extension.
|
||||
*/
|
||||
private function installExtension($extension, $profile_dir)
|
||||
{
|
||||
$temp_dir = $this->createTempDirectory('WebDriverFirefoxProfileExtension');
|
||||
$this->extractTo($extension, $temp_dir);
|
||||
|
||||
// This is a hacky way to parse the id since there is no offical RDF parser library.
|
||||
// Find the correct namespace for the id element.
|
||||
$install_rdf_path = $temp_dir . '/install.rdf';
|
||||
$xml = simplexml_load_file($install_rdf_path);
|
||||
$ns = $xml->getDocNamespaces();
|
||||
$prefix = '';
|
||||
if (!empty($ns)) {
|
||||
foreach ($ns as $key => $value) {
|
||||
if (mb_strpos($value, '//www.mozilla.org/2004/em-rdf') > 0) {
|
||||
if ($key != '') {
|
||||
$prefix = $key . ':'; // Separate the namespace from the name.
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Get the extension id from the install manifest.
|
||||
$matches = [];
|
||||
preg_match('#<' . $prefix . 'id>([^<]+)</' . $prefix . 'id>#', $xml->asXML(), $matches);
|
||||
if (isset($matches[1])) {
|
||||
$ext_dir = $profile_dir . '/extensions/' . $matches[1];
|
||||
mkdir($ext_dir, 0777, true);
|
||||
$this->extractTo($extension, $ext_dir);
|
||||
} else {
|
||||
$this->deleteDirectory($temp_dir);
|
||||
|
||||
throw new WebDriverException('Cannot get the extension id from the install manifest.');
|
||||
}
|
||||
|
||||
$this->deleteDirectory($temp_dir);
|
||||
|
||||
return $ext_dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prefix Prefix of the temp directory.
|
||||
*
|
||||
* @throws WebDriverException
|
||||
* @return string The path to the temp directory created.
|
||||
*/
|
||||
private function createTempDirectory($prefix = '')
|
||||
{
|
||||
$temp_dir = tempnam(sys_get_temp_dir(), $prefix);
|
||||
if (file_exists($temp_dir)) {
|
||||
unlink($temp_dir);
|
||||
mkdir($temp_dir);
|
||||
if (!is_dir($temp_dir)) {
|
||||
throw new WebDriverException('Cannot create firefox profile.');
|
||||
}
|
||||
}
|
||||
|
||||
return $temp_dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $directory The path to the directory.
|
||||
*/
|
||||
private function deleteDirectory($directory)
|
||||
{
|
||||
$dir = new RecursiveDirectoryIterator($directory, FilesystemIterator::SKIP_DOTS);
|
||||
$paths = new RecursiveIteratorIterator($dir, RecursiveIteratorIterator::CHILD_FIRST);
|
||||
|
||||
foreach ($paths as $path) {
|
||||
if ($path->isDir() && !$path->isLink()) {
|
||||
rmdir($path->getPathname());
|
||||
} else {
|
||||
unlink($path->getPathname());
|
||||
}
|
||||
}
|
||||
|
||||
rmdir($directory);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $xpi The path to the .xpi extension.
|
||||
* @param string $target_dir The path to the unzip directory.
|
||||
*
|
||||
* @throws \Exception
|
||||
* @return FirefoxProfile
|
||||
*/
|
||||
private function extractTo($xpi, $target_dir)
|
||||
{
|
||||
$zip = new ZipArchive();
|
||||
if (file_exists($xpi)) {
|
||||
if ($zip->open($xpi)) {
|
||||
$zip->extractTo($target_dir);
|
||||
$zip->close();
|
||||
} else {
|
||||
throw new \Exception("Failed to open the firefox extension. '$xpi'");
|
||||
}
|
||||
} else {
|
||||
throw new \Exception("Firefox extension doesn't exist. '$xpi'");
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
29
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverButtonReleaseAction.php
vendored
Normal file
29
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverButtonReleaseAction.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Internal;
|
||||
|
||||
use Facebook\WebDriver\WebDriverAction;
|
||||
|
||||
/**
|
||||
* Move to the location and then release the mouse key.
|
||||
*/
|
||||
class WebDriverButtonReleaseAction extends WebDriverMouseAction implements WebDriverAction
|
||||
{
|
||||
public function perform()
|
||||
{
|
||||
$this->mouse->mouseUp($this->getActionLocation());
|
||||
}
|
||||
}
|
||||
26
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverClickAction.php
vendored
Normal file
26
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverClickAction.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Internal;
|
||||
|
||||
use Facebook\WebDriver\WebDriverAction;
|
||||
|
||||
class WebDriverClickAction extends WebDriverMouseAction implements WebDriverAction
|
||||
{
|
||||
public function perform()
|
||||
{
|
||||
$this->mouse->click($this->getActionLocation());
|
||||
}
|
||||
}
|
||||
29
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverClickAndHoldAction.php
vendored
Normal file
29
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverClickAndHoldAction.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Internal;
|
||||
|
||||
use Facebook\WebDriver\WebDriverAction;
|
||||
|
||||
/**
|
||||
* Move the the location, click and hold.
|
||||
*/
|
||||
class WebDriverClickAndHoldAction extends WebDriverMouseAction implements WebDriverAction
|
||||
{
|
||||
public function perform()
|
||||
{
|
||||
$this->mouse->mouseDown($this->getActionLocation());
|
||||
}
|
||||
}
|
||||
29
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverContextClickAction.php
vendored
Normal file
29
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverContextClickAction.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Internal;
|
||||
|
||||
use Facebook\WebDriver\WebDriverAction;
|
||||
|
||||
/**
|
||||
* You can call it 'Right Click' if you like.
|
||||
*/
|
||||
class WebDriverContextClickAction extends WebDriverMouseAction implements WebDriverAction
|
||||
{
|
||||
public function perform()
|
||||
{
|
||||
$this->mouse->contextClick($this->getActionLocation());
|
||||
}
|
||||
}
|
||||
91
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverCoordinates.php
vendored
Normal file
91
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverCoordinates.php
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Internal;
|
||||
|
||||
use Facebook\WebDriver\Exception\UnsupportedOperationException;
|
||||
use Facebook\WebDriver\WebDriverPoint;
|
||||
|
||||
/**
|
||||
* Interface representing basic mouse operations.
|
||||
*/
|
||||
class WebDriverCoordinates
|
||||
{
|
||||
/**
|
||||
* @var null
|
||||
*/
|
||||
private $onScreen;
|
||||
/**
|
||||
* @var callable
|
||||
*/
|
||||
private $inViewPort;
|
||||
/**
|
||||
* @var callable
|
||||
*/
|
||||
private $onPage;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $auxiliary;
|
||||
|
||||
/**
|
||||
* @param null $on_screen
|
||||
* @param callable $in_view_port
|
||||
* @param callable $on_page
|
||||
* @param string $auxiliary
|
||||
*/
|
||||
public function __construct($on_screen, callable $in_view_port, callable $on_page, $auxiliary)
|
||||
{
|
||||
$this->onScreen = $on_screen;
|
||||
$this->inViewPort = $in_view_port;
|
||||
$this->onPage = $on_page;
|
||||
$this->auxiliary = $auxiliary;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws UnsupportedOperationException
|
||||
* @return WebDriverPoint
|
||||
*/
|
||||
public function onScreen()
|
||||
{
|
||||
throw new UnsupportedOperationException(
|
||||
'onScreen is planned but not yet supported by Selenium'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WebDriverPoint
|
||||
*/
|
||||
public function inViewPort()
|
||||
{
|
||||
return call_user_func($this->inViewPort);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WebDriverPoint
|
||||
*/
|
||||
public function onPage()
|
||||
{
|
||||
return call_user_func($this->onPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string The attached object id.
|
||||
*/
|
||||
public function getAuxiliary()
|
||||
{
|
||||
return $this->auxiliary;
|
||||
}
|
||||
}
|
||||
26
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverDoubleClickAction.php
vendored
Normal file
26
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverDoubleClickAction.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Internal;
|
||||
|
||||
use Facebook\WebDriver\WebDriverAction;
|
||||
|
||||
class WebDriverDoubleClickAction extends WebDriverMouseAction implements WebDriverAction
|
||||
{
|
||||
public function perform()
|
||||
{
|
||||
$this->mouse->doubleClick($this->getActionLocation());
|
||||
}
|
||||
}
|
||||
27
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverKeyDownAction.php
vendored
Normal file
27
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverKeyDownAction.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Internal;
|
||||
|
||||
use Facebook\WebDriver\WebDriverAction;
|
||||
|
||||
class WebDriverKeyDownAction extends WebDriverSingleKeyAction implements WebDriverAction
|
||||
{
|
||||
public function perform()
|
||||
{
|
||||
$this->focusOnElement();
|
||||
$this->keyboard->pressKey($this->key);
|
||||
}
|
||||
}
|
||||
27
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverKeyUpAction.php
vendored
Normal file
27
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverKeyUpAction.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Internal;
|
||||
|
||||
use Facebook\WebDriver\WebDriverAction;
|
||||
|
||||
class WebDriverKeyUpAction extends WebDriverSingleKeyAction implements WebDriverAction
|
||||
{
|
||||
public function perform()
|
||||
{
|
||||
$this->focusOnElement();
|
||||
$this->keyboard->releaseKey($this->key);
|
||||
}
|
||||
}
|
||||
61
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverKeysRelatedAction.php
vendored
Normal file
61
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverKeysRelatedAction.php
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Internal;
|
||||
|
||||
use Facebook\WebDriver\Internal\WebDriverLocatable;
|
||||
use Facebook\WebDriver\WebDriverKeyboard;
|
||||
use Facebook\WebDriver\WebDriverMouse;
|
||||
|
||||
/**
|
||||
* Base class for all keyboard-related actions.
|
||||
*/
|
||||
abstract class WebDriverKeysRelatedAction
|
||||
{
|
||||
/**
|
||||
* @var WebDriverKeyboard
|
||||
*/
|
||||
protected $keyboard;
|
||||
/**
|
||||
* @var WebDriverMouse
|
||||
*/
|
||||
protected $mouse;
|
||||
/**
|
||||
* @var WebDriverLocatable|null
|
||||
*/
|
||||
protected $locationProvider;
|
||||
|
||||
/**
|
||||
* @param WebDriverKeyboard $keyboard
|
||||
* @param WebDriverMouse $mouse
|
||||
* @param WebDriverLocatable $location_provider
|
||||
*/
|
||||
public function __construct(
|
||||
WebDriverKeyboard $keyboard,
|
||||
WebDriverMouse $mouse,
|
||||
WebDriverLocatable $location_provider = null
|
||||
) {
|
||||
$this->keyboard = $keyboard;
|
||||
$this->mouse = $mouse;
|
||||
$this->locationProvider = $location_provider;
|
||||
}
|
||||
|
||||
protected function focusOnElement()
|
||||
{
|
||||
if ($this->locationProvider) {
|
||||
$this->mouse->click($this->locationProvider->getCoordinates());
|
||||
}
|
||||
}
|
||||
}
|
||||
61
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverMouseAction.php
vendored
Normal file
61
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverMouseAction.php
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Internal;
|
||||
|
||||
use Facebook\WebDriver\Internal\WebDriverLocatable;
|
||||
use Facebook\WebDriver\WebDriverMouse;
|
||||
|
||||
/**
|
||||
* Base class for all mouse-related actions.
|
||||
*/
|
||||
class WebDriverMouseAction
|
||||
{
|
||||
/**
|
||||
* @var WebDriverMouse
|
||||
*/
|
||||
protected $mouse;
|
||||
/**
|
||||
* @var WebDriverLocatable
|
||||
*/
|
||||
protected $locationProvider;
|
||||
|
||||
/**
|
||||
* @param WebDriverMouse $mouse
|
||||
* @param WebDriverLocatable|null $location_provider
|
||||
*/
|
||||
public function __construct(WebDriverMouse $mouse, WebDriverLocatable $location_provider = null)
|
||||
{
|
||||
$this->mouse = $mouse;
|
||||
$this->locationProvider = $location_provider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|WebDriverCoordinates
|
||||
*/
|
||||
protected function getActionLocation()
|
||||
{
|
||||
if ($this->locationProvider !== null) {
|
||||
return $this->locationProvider->getCoordinates();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function moveToLocation()
|
||||
{
|
||||
$this->mouse->mouseMove($this->locationProvider);
|
||||
}
|
||||
}
|
||||
26
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverMouseMoveAction.php
vendored
Normal file
26
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverMouseMoveAction.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Internal;
|
||||
|
||||
use Facebook\WebDriver\WebDriverAction;
|
||||
|
||||
class WebDriverMouseMoveAction extends WebDriverMouseAction implements WebDriverAction
|
||||
{
|
||||
public function perform()
|
||||
{
|
||||
$this->mouse->mouseMove($this->getActionLocation());
|
||||
}
|
||||
}
|
||||
58
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverMoveToOffsetAction.php
vendored
Normal file
58
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverMoveToOffsetAction.php
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Internal;
|
||||
|
||||
use Facebook\WebDriver\Internal\WebDriverLocatable;
|
||||
use Facebook\WebDriver\WebDriverAction;
|
||||
use Facebook\WebDriver\WebDriverMouse;
|
||||
|
||||
class WebDriverMoveToOffsetAction extends WebDriverMouseAction implements WebDriverAction
|
||||
{
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
private $xOffset;
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
private $yOffset;
|
||||
|
||||
/**
|
||||
* @param WebDriverMouse $mouse
|
||||
* @param WebDriverLocatable|null $location_provider
|
||||
* @param int|null $x_offset
|
||||
* @param int|null $y_offset
|
||||
*/
|
||||
public function __construct(
|
||||
WebDriverMouse $mouse,
|
||||
WebDriverLocatable $location_provider = null,
|
||||
$x_offset = null,
|
||||
$y_offset = null
|
||||
) {
|
||||
parent::__construct($mouse, $location_provider);
|
||||
$this->xOffset = $x_offset;
|
||||
$this->yOffset = $y_offset;
|
||||
}
|
||||
|
||||
public function perform()
|
||||
{
|
||||
$this->mouse->mouseMove(
|
||||
$this->getActionLocation(),
|
||||
$this->xOffset,
|
||||
$this->yOffset
|
||||
);
|
||||
}
|
||||
}
|
||||
51
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverSendKeysAction.php
vendored
Normal file
51
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverSendKeysAction.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Internal;
|
||||
|
||||
use Facebook\WebDriver\Internal\WebDriverLocatable;
|
||||
use Facebook\WebDriver\WebDriverAction;
|
||||
use Facebook\WebDriver\WebDriverKeyboard;
|
||||
use Facebook\WebDriver\WebDriverMouse;
|
||||
|
||||
class WebDriverSendKeysAction extends WebDriverKeysRelatedAction implements WebDriverAction
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $keys = '';
|
||||
|
||||
/**
|
||||
* @param WebDriverKeyboard $keyboard
|
||||
* @param WebDriverMouse $mouse
|
||||
* @param WebDriverLocatable $location_provider
|
||||
* @param string $keys
|
||||
*/
|
||||
public function __construct(
|
||||
WebDriverKeyboard $keyboard,
|
||||
WebDriverMouse $mouse,
|
||||
WebDriverLocatable $location_provider = null,
|
||||
$keys = ''
|
||||
) {
|
||||
parent::__construct($keyboard, $mouse, $location_provider);
|
||||
$this->keys = $keys;
|
||||
}
|
||||
|
||||
public function perform()
|
||||
{
|
||||
$this->focusOnElement();
|
||||
$this->keyboard->sendKeys($this->keys);
|
||||
}
|
||||
}
|
||||
37
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverSingleKeyAction.php
vendored
Normal file
37
vendor/facebook/webdriver/lib/Interactions/Internal/WebDriverSingleKeyAction.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Internal;
|
||||
|
||||
use Facebook\WebDriver\Internal\WebDriverLocatable;
|
||||
use Facebook\WebDriver\WebDriverAction;
|
||||
use Facebook\WebDriver\WebDriverKeyboard;
|
||||
use Facebook\WebDriver\WebDriverMouse;
|
||||
|
||||
abstract class WebDriverSingleKeyAction extends WebDriverKeysRelatedAction implements WebDriverAction
|
||||
{
|
||||
/** @var string */
|
||||
protected $key = '';
|
||||
|
||||
public function __construct(
|
||||
WebDriverKeyboard $keyboard,
|
||||
WebDriverMouse $mouse,
|
||||
WebDriverLocatable $location_provider = null,
|
||||
$key = ''
|
||||
) {
|
||||
parent::__construct($keyboard, $mouse, $location_provider);
|
||||
$this->key = $key;
|
||||
}
|
||||
}
|
||||
26
vendor/facebook/webdriver/lib/Interactions/Touch/WebDriverDoubleTapAction.php
vendored
Normal file
26
vendor/facebook/webdriver/lib/Interactions/Touch/WebDriverDoubleTapAction.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Touch;
|
||||
|
||||
use Facebook\WebDriver\WebDriverAction;
|
||||
|
||||
class WebDriverDoubleTapAction extends WebDriverTouchAction implements WebDriverAction
|
||||
{
|
||||
public function perform()
|
||||
{
|
||||
$this->touchScreen->doubleTap($this->locationProvider);
|
||||
}
|
||||
}
|
||||
47
vendor/facebook/webdriver/lib/Interactions/Touch/WebDriverDownAction.php
vendored
Normal file
47
vendor/facebook/webdriver/lib/Interactions/Touch/WebDriverDownAction.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Touch;
|
||||
|
||||
use Facebook\WebDriver\WebDriverAction;
|
||||
|
||||
class WebDriverDownAction extends WebDriverTouchAction implements WebDriverAction
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $x;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $y;
|
||||
|
||||
/**
|
||||
* @param WebDriverTouchScreen $touch_screen
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
*/
|
||||
public function __construct(WebDriverTouchScreen $touch_screen, $x, $y)
|
||||
{
|
||||
$this->x = $x;
|
||||
$this->y = $y;
|
||||
parent::__construct($touch_screen);
|
||||
}
|
||||
|
||||
public function perform()
|
||||
{
|
||||
$this->touchScreen->down($this->x, $this->y);
|
||||
}
|
||||
}
|
||||
47
vendor/facebook/webdriver/lib/Interactions/Touch/WebDriverFlickAction.php
vendored
Normal file
47
vendor/facebook/webdriver/lib/Interactions/Touch/WebDriverFlickAction.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Touch;
|
||||
|
||||
use Facebook\WebDriver\WebDriverAction;
|
||||
|
||||
class WebDriverFlickAction extends WebDriverTouchAction implements WebDriverAction
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $x;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $y;
|
||||
|
||||
/**
|
||||
* @param WebDriverTouchScreen $touch_screen
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
*/
|
||||
public function __construct(WebDriverTouchScreen $touch_screen, $x, $y)
|
||||
{
|
||||
$this->x = $x;
|
||||
$this->y = $y;
|
||||
parent::__construct($touch_screen);
|
||||
}
|
||||
|
||||
public function perform()
|
||||
{
|
||||
$this->touchScreen->flick($this->x, $this->y);
|
||||
}
|
||||
}
|
||||
65
vendor/facebook/webdriver/lib/Interactions/Touch/WebDriverFlickFromElementAction.php
vendored
Normal file
65
vendor/facebook/webdriver/lib/Interactions/Touch/WebDriverFlickFromElementAction.php
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Touch;
|
||||
|
||||
use Facebook\WebDriver\WebDriverAction;
|
||||
use Facebook\WebDriver\WebDriverElement;
|
||||
|
||||
class WebDriverFlickFromElementAction extends WebDriverTouchAction implements WebDriverAction
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $x;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $y;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $speed;
|
||||
|
||||
/**
|
||||
* @param WebDriverTouchScreen $touch_screen
|
||||
* @param WebDriverElement $element
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @param int $speed
|
||||
*/
|
||||
public function __construct(
|
||||
WebDriverTouchScreen $touch_screen,
|
||||
WebDriverElement $element,
|
||||
$x,
|
||||
$y,
|
||||
$speed
|
||||
) {
|
||||
$this->x = $x;
|
||||
$this->y = $y;
|
||||
$this->speed = $speed;
|
||||
parent::__construct($touch_screen, $element);
|
||||
}
|
||||
|
||||
public function perform()
|
||||
{
|
||||
$this->touchScreen->flickFromElement(
|
||||
$this->locationProvider,
|
||||
$this->x,
|
||||
$this->y,
|
||||
$this->speed
|
||||
);
|
||||
}
|
||||
}
|
||||
26
vendor/facebook/webdriver/lib/Interactions/Touch/WebDriverLongPressAction.php
vendored
Normal file
26
vendor/facebook/webdriver/lib/Interactions/Touch/WebDriverLongPressAction.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Touch;
|
||||
|
||||
use Facebook\WebDriver\WebDriverAction;
|
||||
|
||||
class WebDriverLongPressAction extends WebDriverTouchAction implements WebDriverAction
|
||||
{
|
||||
public function perform()
|
||||
{
|
||||
$this->touchScreen->longPress($this->locationProvider);
|
||||
}
|
||||
}
|
||||
41
vendor/facebook/webdriver/lib/Interactions/Touch/WebDriverMoveAction.php
vendored
Normal file
41
vendor/facebook/webdriver/lib/Interactions/Touch/WebDriverMoveAction.php
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Touch;
|
||||
|
||||
use Facebook\WebDriver\WebDriverAction;
|
||||
|
||||
class WebDriverMoveAction extends WebDriverTouchAction implements WebDriverAction
|
||||
{
|
||||
private $x;
|
||||
private $y;
|
||||
|
||||
/**
|
||||
* @param WebDriverTouchScreen $touch_screen
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
*/
|
||||
public function __construct(WebDriverTouchScreen $touch_screen, $x, $y)
|
||||
{
|
||||
$this->x = $x;
|
||||
$this->y = $y;
|
||||
parent::__construct($touch_screen);
|
||||
}
|
||||
|
||||
public function perform()
|
||||
{
|
||||
$this->touchScreen->move($this->x, $this->y);
|
||||
}
|
||||
}
|
||||
41
vendor/facebook/webdriver/lib/Interactions/Touch/WebDriverScrollAction.php
vendored
Normal file
41
vendor/facebook/webdriver/lib/Interactions/Touch/WebDriverScrollAction.php
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Touch;
|
||||
|
||||
use Facebook\WebDriver\WebDriverAction;
|
||||
|
||||
class WebDriverScrollAction extends WebDriverTouchAction implements WebDriverAction
|
||||
{
|
||||
private $x;
|
||||
private $y;
|
||||
|
||||
/**
|
||||
* @param WebDriverTouchScreen $touch_screen
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
*/
|
||||
public function __construct(WebDriverTouchScreen $touch_screen, $x, $y)
|
||||
{
|
||||
$this->x = $x;
|
||||
$this->y = $y;
|
||||
parent::__construct($touch_screen);
|
||||
}
|
||||
|
||||
public function perform()
|
||||
{
|
||||
$this->touchScreen->scroll($this->x, $this->y);
|
||||
}
|
||||
}
|
||||
51
vendor/facebook/webdriver/lib/Interactions/Touch/WebDriverScrollFromElementAction.php
vendored
Normal file
51
vendor/facebook/webdriver/lib/Interactions/Touch/WebDriverScrollFromElementAction.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Touch;
|
||||
|
||||
use Facebook\WebDriver\WebDriverAction;
|
||||
use Facebook\WebDriver\WebDriverElement;
|
||||
|
||||
class WebDriverScrollFromElementAction extends WebDriverTouchAction implements WebDriverAction
|
||||
{
|
||||
private $x;
|
||||
private $y;
|
||||
|
||||
/**
|
||||
* @param WebDriverTouchScreen $touch_screen
|
||||
* @param WebDriverElement $element
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
*/
|
||||
public function __construct(
|
||||
WebDriverTouchScreen $touch_screen,
|
||||
WebDriverElement $element,
|
||||
$x,
|
||||
$y
|
||||
) {
|
||||
$this->x = $x;
|
||||
$this->y = $y;
|
||||
parent::__construct($touch_screen, $element);
|
||||
}
|
||||
|
||||
public function perform()
|
||||
{
|
||||
$this->touchScreen->scrollFromElement(
|
||||
$this->locationProvider,
|
||||
$this->x,
|
||||
$this->y
|
||||
);
|
||||
}
|
||||
}
|
||||
26
vendor/facebook/webdriver/lib/Interactions/Touch/WebDriverTapAction.php
vendored
Normal file
26
vendor/facebook/webdriver/lib/Interactions/Touch/WebDriverTapAction.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Touch;
|
||||
|
||||
use Facebook\WebDriver\WebDriverAction;
|
||||
|
||||
class WebDriverTapAction extends WebDriverTouchAction implements WebDriverAction
|
||||
{
|
||||
public function perform()
|
||||
{
|
||||
$this->touchScreen->tap($this->locationProvider);
|
||||
}
|
||||
}
|
||||
55
vendor/facebook/webdriver/lib/Interactions/Touch/WebDriverTouchAction.php
vendored
Normal file
55
vendor/facebook/webdriver/lib/Interactions/Touch/WebDriverTouchAction.php
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Touch;
|
||||
|
||||
use Facebook\WebDriver\Interactions\Internal\WebDriverCoordinates;
|
||||
use Facebook\WebDriver\Internal\WebDriverLocatable;
|
||||
|
||||
/**
|
||||
* Base class for all touch-related actions.
|
||||
*/
|
||||
abstract class WebDriverTouchAction
|
||||
{
|
||||
/**
|
||||
* @var WebDriverTouchScreen
|
||||
*/
|
||||
protected $touchScreen;
|
||||
/**
|
||||
* @var WebDriverLocatable
|
||||
*/
|
||||
protected $locationProvider;
|
||||
|
||||
/**
|
||||
* @param WebDriverTouchScreen $touch_screen
|
||||
* @param WebDriverLocatable $location_provider
|
||||
*/
|
||||
public function __construct(
|
||||
WebDriverTouchScreen $touch_screen,
|
||||
WebDriverLocatable $location_provider = null
|
||||
) {
|
||||
$this->touchScreen = $touch_screen;
|
||||
$this->locationProvider = $location_provider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|WebDriverCoordinates
|
||||
*/
|
||||
protected function getActionLocation()
|
||||
{
|
||||
return $this->locationProvider !== null
|
||||
? $this->locationProvider->getCoordinates() : null;
|
||||
}
|
||||
}
|
||||
127
vendor/facebook/webdriver/lib/Interactions/Touch/WebDriverTouchScreen.php
vendored
Normal file
127
vendor/facebook/webdriver/lib/Interactions/Touch/WebDriverTouchScreen.php
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions\Touch;
|
||||
|
||||
use Facebook\WebDriver\WebDriverElement;
|
||||
|
||||
/**
|
||||
* Interface representing touch screen operations.
|
||||
*/
|
||||
interface WebDriverTouchScreen
|
||||
{
|
||||
/**
|
||||
* Single tap on the touch enabled device.
|
||||
*
|
||||
* @param WebDriverElement $element
|
||||
* @return $this
|
||||
*/
|
||||
public function tap(WebDriverElement $element);
|
||||
|
||||
/**
|
||||
* Double tap on the touch screen using finger motion events.
|
||||
*
|
||||
* @param WebDriverElement $element
|
||||
* @return $this
|
||||
*/
|
||||
public function doubleTap(WebDriverElement $element);
|
||||
|
||||
/**
|
||||
* Finger down on the screen.
|
||||
*
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @return $this
|
||||
*/
|
||||
public function down($x, $y);
|
||||
|
||||
/**
|
||||
* Flick on the touch screen using finger motion events. Use this flick
|
||||
* command if you don't care where the flick starts on the screen.
|
||||
*
|
||||
* @param int $xspeed
|
||||
* @param int $yspeed
|
||||
* @return $this
|
||||
*/
|
||||
public function flick($xspeed, $yspeed);
|
||||
|
||||
/**
|
||||
* Flick on the touch screen using finger motion events.
|
||||
* This flickcommand starts at a particular screen location.
|
||||
*
|
||||
* @param WebDriverElement $element
|
||||
* @param int $xoffset
|
||||
* @param int $yoffset
|
||||
* @param int $speed
|
||||
* @return $this
|
||||
*/
|
||||
public function flickFromElement(
|
||||
WebDriverElement $element,
|
||||
$xoffset,
|
||||
$yoffset,
|
||||
$speed
|
||||
);
|
||||
|
||||
/**
|
||||
* Long press on the touch screen using finger motion events.
|
||||
*
|
||||
* @param WebDriverElement $element
|
||||
* @return $this
|
||||
*/
|
||||
public function longPress(WebDriverElement $element);
|
||||
|
||||
/**
|
||||
* Finger move on the screen.
|
||||
*
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @return $this
|
||||
*/
|
||||
public function move($x, $y);
|
||||
|
||||
/**
|
||||
* Scroll on the touch screen using finger based motion events. Use this
|
||||
* command if you don't care where the scroll starts on the screen.
|
||||
*
|
||||
* @param int $xoffset
|
||||
* @param int $yoffset
|
||||
* @return $this
|
||||
*/
|
||||
public function scroll($xoffset, $yoffset);
|
||||
|
||||
/**
|
||||
* Scroll on the touch screen using finger based motion events. Use this
|
||||
* command to start scrolling at a particular screen location.
|
||||
*
|
||||
* @param WebDriverElement $element
|
||||
* @param int $xoffset
|
||||
* @param int $yoffset
|
||||
* @return $this
|
||||
*/
|
||||
public function scrollFromElement(
|
||||
WebDriverElement $element,
|
||||
$xoffset,
|
||||
$yoffset
|
||||
);
|
||||
|
||||
/**
|
||||
* Finger up on the screen.
|
||||
*
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @return $this
|
||||
*/
|
||||
public function up($x, $y);
|
||||
}
|
||||
282
vendor/facebook/webdriver/lib/Interactions/WebDriverActions.php
vendored
Normal file
282
vendor/facebook/webdriver/lib/Interactions/WebDriverActions.php
vendored
Normal file
@@ -0,0 +1,282 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions;
|
||||
|
||||
use Facebook\WebDriver\Interactions\Internal\WebDriverButtonReleaseAction;
|
||||
use Facebook\WebDriver\Interactions\Internal\WebDriverClickAction;
|
||||
use Facebook\WebDriver\Interactions\Internal\WebDriverClickAndHoldAction;
|
||||
use Facebook\WebDriver\Interactions\Internal\WebDriverContextClickAction;
|
||||
use Facebook\WebDriver\Interactions\Internal\WebDriverDoubleClickAction;
|
||||
use Facebook\WebDriver\Interactions\Internal\WebDriverKeyDownAction;
|
||||
use Facebook\WebDriver\Interactions\Internal\WebDriverKeyUpAction;
|
||||
use Facebook\WebDriver\Interactions\Internal\WebDriverMouseMoveAction;
|
||||
use Facebook\WebDriver\Interactions\Internal\WebDriverMoveToOffsetAction;
|
||||
use Facebook\WebDriver\Interactions\Internal\WebDriverSendKeysAction;
|
||||
use Facebook\WebDriver\WebDriver;
|
||||
use Facebook\WebDriver\WebDriverElement;
|
||||
use Facebook\WebDriver\WebDriverHasInputDevices;
|
||||
|
||||
/**
|
||||
* WebDriver action builder. It implements the builder pattern.
|
||||
*/
|
||||
class WebDriverActions
|
||||
{
|
||||
protected $driver;
|
||||
protected $keyboard;
|
||||
protected $mouse;
|
||||
protected $action;
|
||||
|
||||
/**
|
||||
* @param WebDriverHasInputDevices $driver
|
||||
*/
|
||||
public function __construct(WebDriverHasInputDevices $driver)
|
||||
{
|
||||
$this->driver = $driver;
|
||||
$this->keyboard = $driver->getKeyboard();
|
||||
$this->mouse = $driver->getMouse();
|
||||
$this->action = new WebDriverCompositeAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* A convenience method for performing the actions without calling build().
|
||||
*/
|
||||
public function perform()
|
||||
{
|
||||
$this->action->perform();
|
||||
}
|
||||
|
||||
/**
|
||||
* Mouse click.
|
||||
* If $element is provided, move to the middle of the element first.
|
||||
*
|
||||
* @param WebDriverElement $element
|
||||
* @return WebDriverActions
|
||||
*/
|
||||
public function click(WebDriverElement $element = null)
|
||||
{
|
||||
$this->action->addAction(
|
||||
new WebDriverClickAction($this->mouse, $element)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mouse click and hold.
|
||||
* If $element is provided, move to the middle of the element first.
|
||||
*
|
||||
* @param WebDriverElement $element
|
||||
* @return WebDriverActions
|
||||
*/
|
||||
public function clickAndHold(WebDriverElement $element = null)
|
||||
{
|
||||
$this->action->addAction(
|
||||
new WebDriverClickAndHoldAction($this->mouse, $element)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Context-click (right click).
|
||||
* If $element is provided, move to the middle of the element first.
|
||||
*
|
||||
* @param WebDriverElement $element
|
||||
* @return WebDriverActions
|
||||
*/
|
||||
public function contextClick(WebDriverElement $element = null)
|
||||
{
|
||||
$this->action->addAction(
|
||||
new WebDriverContextClickAction($this->mouse, $element)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Double click.
|
||||
* If $element is provided, move to the middle of the element first.
|
||||
*
|
||||
* @param WebDriverElement $element
|
||||
* @return WebDriverActions
|
||||
*/
|
||||
public function doubleClick(WebDriverElement $element = null)
|
||||
{
|
||||
$this->action->addAction(
|
||||
new WebDriverDoubleClickAction($this->mouse, $element)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drag and drop from $source to $target.
|
||||
*
|
||||
* @param WebDriverElement $source
|
||||
* @param WebDriverElement $target
|
||||
* @return WebDriverActions
|
||||
*/
|
||||
public function dragAndDrop(WebDriverElement $source, WebDriverElement $target)
|
||||
{
|
||||
$this->action->addAction(
|
||||
new WebDriverClickAndHoldAction($this->mouse, $source)
|
||||
);
|
||||
$this->action->addAction(
|
||||
new WebDriverMouseMoveAction($this->mouse, $target)
|
||||
);
|
||||
$this->action->addAction(
|
||||
new WebDriverButtonReleaseAction($this->mouse, $target)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drag $source and drop by offset ($x_offset, $y_offset).
|
||||
*
|
||||
* @param WebDriverElement $source
|
||||
* @param int $x_offset
|
||||
* @param int $y_offset
|
||||
* @return WebDriverActions
|
||||
*/
|
||||
public function dragAndDropBy(WebDriverElement $source, $x_offset, $y_offset)
|
||||
{
|
||||
$this->action->addAction(
|
||||
new WebDriverClickAndHoldAction($this->mouse, $source)
|
||||
);
|
||||
$this->action->addAction(
|
||||
new WebDriverMoveToOffsetAction($this->mouse, null, $x_offset, $y_offset)
|
||||
);
|
||||
$this->action->addAction(
|
||||
new WebDriverButtonReleaseAction($this->mouse, null)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mouse move by offset.
|
||||
*
|
||||
* @param int $x_offset
|
||||
* @param int $y_offset
|
||||
* @return WebDriverActions
|
||||
*/
|
||||
public function moveByOffset($x_offset, $y_offset)
|
||||
{
|
||||
$this->action->addAction(
|
||||
new WebDriverMoveToOffsetAction($this->mouse, null, $x_offset, $y_offset)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move to the middle of the given WebDriverElement.
|
||||
* Extra shift, calculated from the top-left corner of the element, can be set by passing $x_offset and $y_offset
|
||||
* parameters.
|
||||
*
|
||||
* @param WebDriverElement $element
|
||||
* @param int $x_offset
|
||||
* @param int $y_offset
|
||||
* @return WebDriverActions
|
||||
*/
|
||||
public function moveToElement(WebDriverElement $element, $x_offset = null, $y_offset = null)
|
||||
{
|
||||
$this->action->addAction(new WebDriverMoveToOffsetAction(
|
||||
$this->mouse,
|
||||
$element,
|
||||
$x_offset,
|
||||
$y_offset
|
||||
));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Release the mouse button.
|
||||
* If $element is provided, move to the middle of the element first.
|
||||
*
|
||||
* @param WebDriverElement $element
|
||||
* @return WebDriverActions
|
||||
*/
|
||||
public function release(WebDriverElement $element = null)
|
||||
{
|
||||
$this->action->addAction(
|
||||
new WebDriverButtonReleaseAction($this->mouse, $element)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Press a key on keyboard.
|
||||
* If $element is provided, focus on that element first.
|
||||
*
|
||||
* @see WebDriverKeys for special keys like CONTROL, ALT, etc.
|
||||
* @param WebDriverElement $element
|
||||
* @param string $key
|
||||
* @return WebDriverActions
|
||||
*/
|
||||
public function keyDown(WebDriverElement $element = null, $key = null)
|
||||
{
|
||||
$this->action->addAction(
|
||||
new WebDriverKeyDownAction($this->keyboard, $this->mouse, $element, $key)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Release a key on keyboard.
|
||||
* If $element is provided, focus on that element first.
|
||||
*
|
||||
* @see WebDriverKeys for special keys like CONTROL, ALT, etc.
|
||||
* @param WebDriverElement $element
|
||||
* @param string $key
|
||||
* @return WebDriverActions
|
||||
*/
|
||||
public function keyUp(WebDriverElement $element = null, $key = null)
|
||||
{
|
||||
$this->action->addAction(
|
||||
new WebDriverKeyUpAction($this->keyboard, $this->mouse, $element, $key)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send keys by keyboard.
|
||||
* If $element is provided, focus on that element first.
|
||||
*
|
||||
* @see WebDriverKeys for special keys like CONTROL, ALT, etc.
|
||||
* @param WebDriverElement $element
|
||||
* @param string $keys
|
||||
* @return WebDriverActions
|
||||
*/
|
||||
public function sendKeys(WebDriverElement $element = null, $keys = null)
|
||||
{
|
||||
$this->action->addAction(
|
||||
new WebDriverSendKeysAction(
|
||||
$this->keyboard,
|
||||
$this->mouse,
|
||||
$element,
|
||||
$keys
|
||||
)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
62
vendor/facebook/webdriver/lib/Interactions/WebDriverCompositeAction.php
vendored
Normal file
62
vendor/facebook/webdriver/lib/Interactions/WebDriverCompositeAction.php
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions;
|
||||
|
||||
use Facebook\WebDriver\WebDriverAction;
|
||||
|
||||
/**
|
||||
* An action for aggregating actions and triggering all of them afterwards.
|
||||
*/
|
||||
class WebDriverCompositeAction implements WebDriverAction
|
||||
{
|
||||
/**
|
||||
* @var WebDriverAction[]
|
||||
*/
|
||||
private $actions = [];
|
||||
|
||||
/**
|
||||
* Add an WebDriverAction to the sequence.
|
||||
*
|
||||
* @param WebDriverAction $action
|
||||
* @return WebDriverCompositeAction The current instance.
|
||||
*/
|
||||
public function addAction(WebDriverAction $action)
|
||||
{
|
||||
$this->actions[] = $action;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of actions in the sequence.
|
||||
*
|
||||
* @return int The number of actions.
|
||||
*/
|
||||
public function getNumberOfActions()
|
||||
{
|
||||
return count($this->actions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform the sequence of actions.
|
||||
*/
|
||||
public function perform()
|
||||
{
|
||||
foreach ($this->actions as $action) {
|
||||
$action->perform();
|
||||
}
|
||||
}
|
||||
}
|
||||
193
vendor/facebook/webdriver/lib/Interactions/WebDriverTouchActions.php
vendored
Normal file
193
vendor/facebook/webdriver/lib/Interactions/WebDriverTouchActions.php
vendored
Normal file
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Interactions;
|
||||
|
||||
use Facebook\WebDriver\Interactions\Touch\WebDriverDoubleTapAction;
|
||||
use Facebook\WebDriver\Interactions\Touch\WebDriverDownAction;
|
||||
use Facebook\WebDriver\Interactions\Touch\WebDriverFlickAction;
|
||||
use Facebook\WebDriver\Interactions\Touch\WebDriverFlickFromElementAction;
|
||||
use Facebook\WebDriver\Interactions\Touch\WebDriverLongPressAction;
|
||||
use Facebook\WebDriver\Interactions\Touch\WebDriverMoveAction;
|
||||
use Facebook\WebDriver\Interactions\Touch\WebDriverScrollAction;
|
||||
use Facebook\WebDriver\Interactions\Touch\WebDriverScrollFromElementAction;
|
||||
use Facebook\WebDriver\Interactions\Touch\WebDriverTapAction;
|
||||
use Facebook\WebDriver\Interactions\Touch\WebDriverTouchScreen;
|
||||
use Facebook\WebDriver\WebDriver;
|
||||
use Facebook\WebDriver\WebDriverElement;
|
||||
use Facebook\WebDriver\WebDriverUpAction;
|
||||
|
||||
/**
|
||||
* WebDriver action builder for touch events
|
||||
*/
|
||||
class WebDriverTouchActions extends WebDriverActions
|
||||
{
|
||||
/**
|
||||
* @var WebDriverTouchScreen
|
||||
*/
|
||||
protected $touchScreen;
|
||||
|
||||
public function __construct(WebDriver $driver)
|
||||
{
|
||||
parent::__construct($driver);
|
||||
$this->touchScreen = $driver->getTouch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverElement $element
|
||||
* @return WebDriverTouchActions
|
||||
*/
|
||||
public function tap(WebDriverElement $element)
|
||||
{
|
||||
$this->action->addAction(
|
||||
new WebDriverTapAction($this->touchScreen, $element)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @return WebDriverTouchActions
|
||||
*/
|
||||
public function down($x, $y)
|
||||
{
|
||||
$this->action->addAction(
|
||||
new WebDriverDownAction($this->touchScreen, $x, $y)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @return WebDriverTouchActions
|
||||
*/
|
||||
public function up($x, $y)
|
||||
{
|
||||
$this->action->addAction(
|
||||
new WebDriverUpAction($this->touchScreen, $x, $y)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @return WebDriverTouchActions
|
||||
*/
|
||||
public function move($x, $y)
|
||||
{
|
||||
$this->action->addAction(
|
||||
new WebDriverMoveAction($this->touchScreen, $x, $y)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @return WebDriverTouchActions
|
||||
*/
|
||||
public function scroll($x, $y)
|
||||
{
|
||||
$this->action->addAction(
|
||||
new WebDriverScrollAction($this->touchScreen, $x, $y)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverElement $element
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @return WebDriverTouchActions
|
||||
*/
|
||||
public function scrollFromElement(WebDriverElement $element, $x, $y)
|
||||
{
|
||||
$this->action->addAction(
|
||||
new WebDriverScrollFromElementAction($this->touchScreen, $element, $x, $y)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverElement $element
|
||||
* @return WebDriverTouchActions
|
||||
*/
|
||||
public function doubleTap(WebDriverElement $element)
|
||||
{
|
||||
$this->action->addAction(
|
||||
new WebDriverDoubleTapAction($this->touchScreen, $element)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverElement $element
|
||||
* @return WebDriverTouchActions
|
||||
*/
|
||||
public function longPress(WebDriverElement $element)
|
||||
{
|
||||
$this->action->addAction(
|
||||
new WebDriverLongPressAction($this->touchScreen, $element)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @return WebDriverTouchActions
|
||||
*/
|
||||
public function flick($x, $y)
|
||||
{
|
||||
$this->action->addAction(
|
||||
new WebDriverFlickAction($this->touchScreen, $x, $y)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverElement $element
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @param int $speed
|
||||
* @return WebDriverTouchActions
|
||||
*/
|
||||
public function flickFromElement(WebDriverElement $element, $x, $y, $speed)
|
||||
{
|
||||
$this->action->addAction(
|
||||
new WebDriverFlickFromElementAction(
|
||||
$this->touchScreen,
|
||||
$element,
|
||||
$x,
|
||||
$y,
|
||||
$speed
|
||||
)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
29
vendor/facebook/webdriver/lib/Internal/WebDriverLocatable.php
vendored
Normal file
29
vendor/facebook/webdriver/lib/Internal/WebDriverLocatable.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
// copyright 2004-present facebook. all rights reserved.
|
||||
//
|
||||
// licensed under the apache license, version 2.0 (the "license");
|
||||
// you may not use this file except in compliance with the license.
|
||||
// you may obtain a copy of the license at
|
||||
//
|
||||
// http://www.apache.org/licenses/license-2.0
|
||||
//
|
||||
// unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the license is distributed on an "as is" basis,
|
||||
// without warranties or conditions of any kind, either express or implied.
|
||||
// see the license for the specific language governing permissions and
|
||||
// limitations under the license.
|
||||
|
||||
namespace Facebook\WebDriver\Internal;
|
||||
|
||||
use Facebook\WebDriver\Interactions\Internal\WebDriverCoordinates;
|
||||
|
||||
/**
|
||||
* Interface representing basic mouse operations.
|
||||
*/
|
||||
interface WebDriverLocatable
|
||||
{
|
||||
/**
|
||||
* @return WebDriverCoordinates
|
||||
*/
|
||||
public function getCoordinates();
|
||||
}
|
||||
48
vendor/facebook/webdriver/lib/JavaScriptExecutor.php
vendored
Normal file
48
vendor/facebook/webdriver/lib/JavaScriptExecutor.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver;
|
||||
|
||||
/**
|
||||
* WebDriver interface implemented by drivers that support JavaScript.
|
||||
*/
|
||||
interface JavaScriptExecutor
|
||||
{
|
||||
/**
|
||||
* Inject a snippet of JavaScript into the page for execution in the context
|
||||
* of the currently selected frame. The executed script is assumed to be
|
||||
* synchronous and the result of evaluating the script will be returned.
|
||||
*
|
||||
* @param string $script The script to inject.
|
||||
* @param array $arguments The arguments of the script.
|
||||
* @return mixed The return value of the script.
|
||||
*/
|
||||
public function executeScript($script, array $arguments = []);
|
||||
|
||||
/**
|
||||
* Inject a snippet of JavaScript into the page for asynchronous execution in
|
||||
* the context of the currently selected frame.
|
||||
*
|
||||
* The driver will pass a callback as the last argument to the snippet, and
|
||||
* block until the callback is invoked.
|
||||
*
|
||||
* @see WebDriverExecuteAsyncScriptTestCase
|
||||
*
|
||||
* @param string $script The script to inject.
|
||||
* @param array $arguments The arguments of the script.
|
||||
* @return mixed The value passed by the script to the callback.
|
||||
*/
|
||||
public function executeAsyncScript($script, array $arguments = []);
|
||||
}
|
||||
85
vendor/facebook/webdriver/lib/Net/URLChecker.php
vendored
Normal file
85
vendor/facebook/webdriver/lib/Net/URLChecker.php
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Net;
|
||||
|
||||
use Exception;
|
||||
use Facebook\WebDriver\Exception\TimeOutException;
|
||||
|
||||
class URLChecker
|
||||
{
|
||||
const POLL_INTERVAL_MS = 500;
|
||||
const CONNECT_TIMEOUT_MS = 500;
|
||||
|
||||
public function waitUntilAvailable($timeout_in_ms, $url)
|
||||
{
|
||||
$end = microtime(true) + $timeout_in_ms / 1000;
|
||||
|
||||
while ($end > microtime(true)) {
|
||||
if ($this->getHTTPResponseCode($url) === 200) {
|
||||
return $this;
|
||||
}
|
||||
usleep(self::POLL_INTERVAL_MS);
|
||||
}
|
||||
|
||||
throw new TimeOutException(sprintf(
|
||||
'Timed out waiting for %s to become available after %d ms.',
|
||||
$url,
|
||||
$timeout_in_ms
|
||||
));
|
||||
}
|
||||
|
||||
public function waitUntilUnavailable($timeout_in_ms, $url)
|
||||
{
|
||||
$end = microtime(true) + $timeout_in_ms / 1000;
|
||||
|
||||
while ($end > microtime(true)) {
|
||||
if ($this->getHTTPResponseCode($url) !== 200) {
|
||||
return $this;
|
||||
}
|
||||
usleep(self::POLL_INTERVAL_MS);
|
||||
}
|
||||
|
||||
throw new TimeOutException(sprintf(
|
||||
'Timed out waiting for %s to become unavailable after %d ms.',
|
||||
$url,
|
||||
$timeout_in_ms
|
||||
));
|
||||
}
|
||||
|
||||
private function getHTTPResponseCode($url)
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
// The PHP doc indicates that CURLOPT_CONNECTTIMEOUT_MS constant is added in cURL 7.16.2
|
||||
// available since PHP 5.2.3.
|
||||
if (!defined('CURLOPT_CONNECTTIMEOUT_MS')) {
|
||||
define('CURLOPT_CONNECTTIMEOUT_MS', 156); // default value for CURLOPT_CONNECTTIMEOUT_MS
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, self::CONNECT_TIMEOUT_MS);
|
||||
|
||||
$code = null;
|
||||
try {
|
||||
curl_exec($ch);
|
||||
$info = curl_getinfo($ch);
|
||||
$code = $info['http_code'];
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
curl_close($ch);
|
||||
|
||||
return $code;
|
||||
}
|
||||
}
|
||||
344
vendor/facebook/webdriver/lib/Remote/DesiredCapabilities.php
vendored
Normal file
344
vendor/facebook/webdriver/lib/Remote/DesiredCapabilities.php
vendored
Normal file
@@ -0,0 +1,344 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Remote;
|
||||
|
||||
use Exception;
|
||||
use Facebook\WebDriver\Chrome\ChromeOptions;
|
||||
use Facebook\WebDriver\Firefox\FirefoxDriver;
|
||||
use Facebook\WebDriver\Firefox\FirefoxPreferences;
|
||||
use Facebook\WebDriver\Firefox\FirefoxProfile;
|
||||
use Facebook\WebDriver\WebDriverCapabilities;
|
||||
use Facebook\WebDriver\WebDriverPlatform;
|
||||
|
||||
class DesiredCapabilities implements WebDriverCapabilities
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $capabilities;
|
||||
|
||||
public function __construct(array $capabilities = [])
|
||||
{
|
||||
$this->capabilities = $capabilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string The name of the browser.
|
||||
*/
|
||||
public function getBrowserName()
|
||||
{
|
||||
return $this->get(WebDriverCapabilityType::BROWSER_NAME, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $browser_name
|
||||
* @return DesiredCapabilities
|
||||
*/
|
||||
public function setBrowserName($browser_name)
|
||||
{
|
||||
$this->set(WebDriverCapabilityType::BROWSER_NAME, $browser_name);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string The version of the browser.
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return $this->get(WebDriverCapabilityType::VERSION, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $version
|
||||
* @return DesiredCapabilities
|
||||
*/
|
||||
public function setVersion($version)
|
||||
{
|
||||
$this->set(WebDriverCapabilityType::VERSION, $version);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return mixed The value of a capability.
|
||||
*/
|
||||
public function getCapability($name)
|
||||
{
|
||||
return $this->get($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @return DesiredCapabilities
|
||||
*/
|
||||
public function setCapability($name, $value)
|
||||
{
|
||||
$this->set($name, $value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string The name of the platform.
|
||||
*/
|
||||
public function getPlatform()
|
||||
{
|
||||
return $this->get(WebDriverCapabilityType::PLATFORM, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $platform
|
||||
* @return DesiredCapabilities
|
||||
*/
|
||||
public function setPlatform($platform)
|
||||
{
|
||||
$this->set(WebDriverCapabilityType::PLATFORM, $platform);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $capability_name
|
||||
* @return bool Whether the value is not null and not false.
|
||||
*/
|
||||
public function is($capability_name)
|
||||
{
|
||||
return (bool) $this->get($capability_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Remove in next major release (BC)
|
||||
* @deprecated All browsers are always JS enabled except HtmlUnit and it's not meaningful to disable JS execution.
|
||||
* @return bool Whether javascript is enabled.
|
||||
*/
|
||||
public function isJavascriptEnabled()
|
||||
{
|
||||
return $this->get(WebDriverCapabilityType::JAVASCRIPT_ENABLED, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a htmlUnit-only option.
|
||||
*
|
||||
* @param bool $enabled
|
||||
* @throws Exception
|
||||
* @return DesiredCapabilities
|
||||
* @see https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities#read-write-capabilities
|
||||
*/
|
||||
public function setJavascriptEnabled($enabled)
|
||||
{
|
||||
$browser = $this->getBrowserName();
|
||||
if ($browser && $browser !== WebDriverBrowserType::HTMLUNIT) {
|
||||
throw new Exception(
|
||||
'isJavascriptEnabled() is a htmlunit-only option. ' .
|
||||
'See https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities#read-write-capabilities.'
|
||||
);
|
||||
}
|
||||
|
||||
$this->set(WebDriverCapabilityType::JAVASCRIPT_ENABLED, $enabled);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
if (isset($this->capabilities[ChromeOptions::CAPABILITY]) &&
|
||||
$this->capabilities[ChromeOptions::CAPABILITY] instanceof ChromeOptions
|
||||
) {
|
||||
$this->capabilities[ChromeOptions::CAPABILITY] =
|
||||
$this->capabilities[ChromeOptions::CAPABILITY]->toArray();
|
||||
}
|
||||
|
||||
if (isset($this->capabilities[FirefoxDriver::PROFILE]) &&
|
||||
$this->capabilities[FirefoxDriver::PROFILE] instanceof FirefoxProfile
|
||||
) {
|
||||
$this->capabilities[FirefoxDriver::PROFILE] =
|
||||
$this->capabilities[FirefoxDriver::PROFILE]->encode();
|
||||
}
|
||||
|
||||
return $this->capabilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return static
|
||||
*/
|
||||
public static function android()
|
||||
{
|
||||
return new static([
|
||||
WebDriverCapabilityType::BROWSER_NAME => WebDriverBrowserType::ANDROID,
|
||||
WebDriverCapabilityType::PLATFORM => WebDriverPlatform::ANDROID,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return static
|
||||
*/
|
||||
public static function chrome()
|
||||
{
|
||||
return new static([
|
||||
WebDriverCapabilityType::BROWSER_NAME => WebDriverBrowserType::CHROME,
|
||||
WebDriverCapabilityType::PLATFORM => WebDriverPlatform::ANY,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return static
|
||||
*/
|
||||
public static function firefox()
|
||||
{
|
||||
$caps = new static([
|
||||
WebDriverCapabilityType::BROWSER_NAME => WebDriverBrowserType::FIREFOX,
|
||||
WebDriverCapabilityType::PLATFORM => WebDriverPlatform::ANY,
|
||||
]);
|
||||
|
||||
// disable the "Reader View" help tooltip, which can hide elements in the window.document
|
||||
$profile = new FirefoxProfile();
|
||||
$profile->setPreference(FirefoxPreferences::READER_PARSE_ON_LOAD_ENABLED, false);
|
||||
$caps->setCapability(FirefoxDriver::PROFILE, $profile);
|
||||
|
||||
return $caps;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return static
|
||||
*/
|
||||
public static function htmlUnit()
|
||||
{
|
||||
return new static([
|
||||
WebDriverCapabilityType::BROWSER_NAME => WebDriverBrowserType::HTMLUNIT,
|
||||
WebDriverCapabilityType::PLATFORM => WebDriverPlatform::ANY,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return static
|
||||
*/
|
||||
public static function htmlUnitWithJS()
|
||||
{
|
||||
$caps = new static([
|
||||
WebDriverCapabilityType::BROWSER_NAME => WebDriverBrowserType::HTMLUNIT,
|
||||
WebDriverCapabilityType::PLATFORM => WebDriverPlatform::ANY,
|
||||
]);
|
||||
|
||||
return $caps->setJavascriptEnabled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return static
|
||||
*/
|
||||
public static function internetExplorer()
|
||||
{
|
||||
return new static([
|
||||
WebDriverCapabilityType::BROWSER_NAME => WebDriverBrowserType::IE,
|
||||
WebDriverCapabilityType::PLATFORM => WebDriverPlatform::WINDOWS,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return static
|
||||
*/
|
||||
public static function microsoftEdge()
|
||||
{
|
||||
return new static([
|
||||
WebDriverCapabilityType::BROWSER_NAME => WebDriverBrowserType::MICROSOFT_EDGE,
|
||||
WebDriverCapabilityType::PLATFORM => WebDriverPlatform::WINDOWS,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return static
|
||||
*/
|
||||
public static function iphone()
|
||||
{
|
||||
return new static([
|
||||
WebDriverCapabilityType::BROWSER_NAME => WebDriverBrowserType::IPHONE,
|
||||
WebDriverCapabilityType::PLATFORM => WebDriverPlatform::MAC,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return static
|
||||
*/
|
||||
public static function ipad()
|
||||
{
|
||||
return new static([
|
||||
WebDriverCapabilityType::BROWSER_NAME => WebDriverBrowserType::IPAD,
|
||||
WebDriverCapabilityType::PLATFORM => WebDriverPlatform::MAC,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return static
|
||||
*/
|
||||
public static function opera()
|
||||
{
|
||||
return new static([
|
||||
WebDriverCapabilityType::BROWSER_NAME => WebDriverBrowserType::OPERA,
|
||||
WebDriverCapabilityType::PLATFORM => WebDriverPlatform::ANY,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return static
|
||||
*/
|
||||
public static function safari()
|
||||
{
|
||||
return new static([
|
||||
WebDriverCapabilityType::BROWSER_NAME => WebDriverBrowserType::SAFARI,
|
||||
WebDriverCapabilityType::PLATFORM => WebDriverPlatform::ANY,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return static
|
||||
*/
|
||||
public static function phantomjs()
|
||||
{
|
||||
return new static([
|
||||
WebDriverCapabilityType::BROWSER_NAME => WebDriverBrowserType::PHANTOMJS,
|
||||
WebDriverCapabilityType::PLATFORM => WebDriverPlatform::ANY,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return DesiredCapabilities
|
||||
*/
|
||||
private function set($key, $value)
|
||||
{
|
||||
$this->capabilities[$key] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
private function get($key, $default = null)
|
||||
{
|
||||
return isset($this->capabilities[$key])
|
||||
? $this->capabilities[$key]
|
||||
: $default;
|
||||
}
|
||||
}
|
||||
152
vendor/facebook/webdriver/lib/Remote/DriverCommand.php
vendored
Normal file
152
vendor/facebook/webdriver/lib/Remote/DriverCommand.php
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Remote;
|
||||
|
||||
/**
|
||||
* This list of command defined in the WebDriver json wire protocol.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class DriverCommand
|
||||
{
|
||||
const GET_ALL_SESSIONS = 'getAllSessions';
|
||||
const GET_CAPABILITIES = 'getCapabilities';
|
||||
const NEW_SESSION = 'newSession';
|
||||
const STATUS = 'status';
|
||||
const CLOSE = 'close';
|
||||
const QUIT = 'quit';
|
||||
const GET = 'get';
|
||||
const GO_BACK = 'goBack';
|
||||
const GO_FORWARD = 'goForward';
|
||||
const REFRESH = 'refresh';
|
||||
const ADD_COOKIE = 'addCookie';
|
||||
const GET_ALL_COOKIES = 'getCookies';
|
||||
const DELETE_COOKIE = 'deleteCookie';
|
||||
const DELETE_ALL_COOKIES = 'deleteAllCookies';
|
||||
const FIND_ELEMENT = 'findElement';
|
||||
const FIND_ELEMENTS = 'findElements';
|
||||
const FIND_CHILD_ELEMENT = 'findChildElement';
|
||||
const FIND_CHILD_ELEMENTS = 'findChildElements';
|
||||
const CLEAR_ELEMENT = 'clearElement';
|
||||
const CLICK_ELEMENT = 'clickElement';
|
||||
const SEND_KEYS_TO_ELEMENT = 'sendKeysToElement';
|
||||
const SEND_KEYS_TO_ACTIVE_ELEMENT = 'sendKeysToActiveElement';
|
||||
const SUBMIT_ELEMENT = 'submitElement';
|
||||
const UPLOAD_FILE = 'uploadFile';
|
||||
const GET_CURRENT_WINDOW_HANDLE = 'getCurrentWindowHandle';
|
||||
const GET_WINDOW_HANDLES = 'getWindowHandles';
|
||||
const GET_CURRENT_CONTEXT_HANDLE = 'getCurrentContextHandle';
|
||||
const GET_CONTEXT_HANDLES = 'getContextHandles';
|
||||
// Switching between to window/frame/iframe
|
||||
const SWITCH_TO_WINDOW = 'switchToWindow';
|
||||
const SWITCH_TO_CONTEXT = 'switchToContext';
|
||||
const SWITCH_TO_FRAME = 'switchToFrame';
|
||||
const SWITCH_TO_PARENT_FRAME = 'switchToParentFrame';
|
||||
const GET_ACTIVE_ELEMENT = 'getActiveElement';
|
||||
// Information of the page
|
||||
const GET_CURRENT_URL = 'getCurrentUrl';
|
||||
const GET_PAGE_SOURCE = 'getPageSource';
|
||||
const GET_TITLE = 'getTitle';
|
||||
// Javascript API
|
||||
const EXECUTE_SCRIPT = 'executeScript';
|
||||
const EXECUTE_ASYNC_SCRIPT = 'executeAsyncScript';
|
||||
// API getting information from an element.
|
||||
const GET_ELEMENT_TEXT = 'getElementText';
|
||||
const GET_ELEMENT_TAG_NAME = 'getElementTagName';
|
||||
const IS_ELEMENT_SELECTED = 'isElementSelected';
|
||||
const IS_ELEMENT_ENABLED = 'isElementEnabled';
|
||||
const IS_ELEMENT_DISPLAYED = 'isElementDisplayed';
|
||||
const GET_ELEMENT_LOCATION = 'getElementLocation';
|
||||
const GET_ELEMENT_LOCATION_ONCE_SCROLLED_INTO_VIEW = 'getElementLocationOnceScrolledIntoView';
|
||||
const GET_ELEMENT_SIZE = 'getElementSize';
|
||||
const GET_ELEMENT_ATTRIBUTE = 'getElementAttribute';
|
||||
const GET_ELEMENT_VALUE_OF_CSS_PROPERTY = 'getElementValueOfCssProperty';
|
||||
const ELEMENT_EQUALS = 'elementEquals';
|
||||
const SCREENSHOT = 'screenshot';
|
||||
// Alert API
|
||||
const ACCEPT_ALERT = 'acceptAlert';
|
||||
const DISMISS_ALERT = 'dismissAlert';
|
||||
const GET_ALERT_TEXT = 'getAlertText';
|
||||
const SET_ALERT_VALUE = 'setAlertValue';
|
||||
// Timeout API
|
||||
const SET_TIMEOUT = 'setTimeout';
|
||||
const IMPLICITLY_WAIT = 'implicitlyWait';
|
||||
const SET_SCRIPT_TIMEOUT = 'setScriptTimeout';
|
||||
/** @deprecated */
|
||||
const EXECUTE_SQL = 'executeSQL';
|
||||
const GET_LOCATION = 'getLocation';
|
||||
const SET_LOCATION = 'setLocation';
|
||||
const GET_APP_CACHE = 'getAppCache';
|
||||
const GET_APP_CACHE_STATUS = 'getStatus';
|
||||
const CLEAR_APP_CACHE = 'clearAppCache';
|
||||
const IS_BROWSER_ONLINE = 'isBrowserOnline';
|
||||
const SET_BROWSER_ONLINE = 'setBrowserOnline';
|
||||
// Local storage
|
||||
const GET_LOCAL_STORAGE_ITEM = 'getLocalStorageItem';
|
||||
const GET_LOCAL_STORAGE_KEYS = 'getLocalStorageKeys';
|
||||
const SET_LOCAL_STORAGE_ITEM = 'setLocalStorageItem';
|
||||
const REMOVE_LOCAL_STORAGE_ITEM = 'removeLocalStorageItem';
|
||||
const CLEAR_LOCAL_STORAGE = 'clearLocalStorage';
|
||||
const GET_LOCAL_STORAGE_SIZE = 'getLocalStorageSize';
|
||||
// Session storage
|
||||
const GET_SESSION_STORAGE_ITEM = 'getSessionStorageItem';
|
||||
const GET_SESSION_STORAGE_KEYS = 'getSessionStorageKey';
|
||||
const SET_SESSION_STORAGE_ITEM = 'setSessionStorageItem';
|
||||
const REMOVE_SESSION_STORAGE_ITEM = 'removeSessionStorageItem';
|
||||
const CLEAR_SESSION_STORAGE = 'clearSessionStorage';
|
||||
const GET_SESSION_STORAGE_SIZE = 'getSessionStorageSize';
|
||||
// Screen orientation
|
||||
const SET_SCREEN_ORIENTATION = 'setScreenOrientation';
|
||||
const GET_SCREEN_ORIENTATION = 'getScreenOrientation';
|
||||
// These belong to the Advanced user interactions - an element is optional for these commands.
|
||||
const CLICK = 'mouseClick';
|
||||
const DOUBLE_CLICK = 'mouseDoubleClick';
|
||||
const MOUSE_DOWN = 'mouseButtonDown';
|
||||
const MOUSE_UP = 'mouseButtonUp';
|
||||
const MOVE_TO = 'mouseMoveTo';
|
||||
// Those allow interactions with the Input Methods installed on the system.
|
||||
const IME_GET_AVAILABLE_ENGINES = 'imeGetAvailableEngines';
|
||||
const IME_GET_ACTIVE_ENGINE = 'imeGetActiveEngine';
|
||||
const IME_IS_ACTIVATED = 'imeIsActivated';
|
||||
const IME_DEACTIVATE = 'imeDeactivate';
|
||||
const IME_ACTIVATE_ENGINE = 'imeActivateEngine';
|
||||
// These belong to the Advanced Touch API
|
||||
const TOUCH_SINGLE_TAP = 'touchSingleTap';
|
||||
const TOUCH_DOWN = 'touchDown';
|
||||
const TOUCH_UP = 'touchUp';
|
||||
const TOUCH_MOVE = 'touchMove';
|
||||
const TOUCH_SCROLL = 'touchScroll';
|
||||
const TOUCH_DOUBLE_TAP = 'touchDoubleTap';
|
||||
const TOUCH_LONG_PRESS = 'touchLongPress';
|
||||
const TOUCH_FLICK = 'touchFlick';
|
||||
// Window API (beta)
|
||||
const SET_WINDOW_SIZE = 'setWindowSize';
|
||||
const SET_WINDOW_POSITION = 'setWindowPosition';
|
||||
const GET_WINDOW_SIZE = 'getWindowSize';
|
||||
const GET_WINDOW_POSITION = 'getWindowPosition';
|
||||
const MAXIMIZE_WINDOW = 'maximizeWindow';
|
||||
// Logging API
|
||||
const GET_AVAILABLE_LOG_TYPES = 'getAvailableLogTypes';
|
||||
const GET_LOG = 'getLog';
|
||||
const GET_SESSION_LOGS = 'getSessionLogs';
|
||||
// Mobile API
|
||||
const GET_NETWORK_CONNECTION = 'getNetworkConnection';
|
||||
const SET_NETWORK_CONNECTION = 'setNetworkConnection';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
}
|
||||
26
vendor/facebook/webdriver/lib/Remote/ExecuteMethod.php
vendored
Normal file
26
vendor/facebook/webdriver/lib/Remote/ExecuteMethod.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Remote;
|
||||
|
||||
interface ExecuteMethod
|
||||
{
|
||||
/**
|
||||
* @param string $command_name
|
||||
* @param array $parameters
|
||||
* @return WebDriverResponse
|
||||
*/
|
||||
public function execute($command_name, array $parameters = []);
|
||||
}
|
||||
29
vendor/facebook/webdriver/lib/Remote/FileDetector.php
vendored
Normal file
29
vendor/facebook/webdriver/lib/Remote/FileDetector.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Remote;
|
||||
|
||||
interface FileDetector
|
||||
{
|
||||
/**
|
||||
* Try to detect whether the given $file is a file or not. Return the path
|
||||
* of the file. Otherwise, return null.
|
||||
*
|
||||
* @param string $file
|
||||
*
|
||||
* @return null|string The path of the file.
|
||||
*/
|
||||
public function getLocalFile($file);
|
||||
}
|
||||
343
vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php
vendored
Normal file
343
vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php
vendored
Normal file
@@ -0,0 +1,343 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Remote;
|
||||
|
||||
use BadMethodCallException;
|
||||
use Facebook\WebDriver\Exception\WebDriverCurlException;
|
||||
use Facebook\WebDriver\Exception\WebDriverException;
|
||||
use Facebook\WebDriver\WebDriverCommandExecutor;
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Command executor talking to the standalone server via HTTP.
|
||||
*/
|
||||
class HttpCommandExecutor implements WebDriverCommandExecutor
|
||||
{
|
||||
const DEFAULT_HTTP_HEADERS = [
|
||||
'Content-Type: application/json;charset=UTF-8',
|
||||
'Accept: application/json',
|
||||
];
|
||||
|
||||
/**
|
||||
* @see https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#command-reference
|
||||
*/
|
||||
protected static $commands = [
|
||||
DriverCommand::ACCEPT_ALERT => ['method' => 'POST', 'url' => '/session/:sessionId/accept_alert'],
|
||||
DriverCommand::ADD_COOKIE => ['method' => 'POST', 'url' => '/session/:sessionId/cookie'],
|
||||
DriverCommand::CLEAR_ELEMENT => ['method' => 'POST', 'url' => '/session/:sessionId/element/:id/clear'],
|
||||
DriverCommand::CLICK_ELEMENT => ['method' => 'POST', 'url' => '/session/:sessionId/element/:id/click'],
|
||||
DriverCommand::CLOSE => ['method' => 'DELETE', 'url' => '/session/:sessionId/window'],
|
||||
DriverCommand::DELETE_ALL_COOKIES => ['method' => 'DELETE', 'url' => '/session/:sessionId/cookie'],
|
||||
DriverCommand::DELETE_COOKIE => ['method' => 'DELETE', 'url' => '/session/:sessionId/cookie/:name'],
|
||||
DriverCommand::DISMISS_ALERT => ['method' => 'POST', 'url' => '/session/:sessionId/dismiss_alert'],
|
||||
DriverCommand::ELEMENT_EQUALS => ['method' => 'GET', 'url' => '/session/:sessionId/element/:id/equals/:other'],
|
||||
DriverCommand::FIND_CHILD_ELEMENT => ['method' => 'POST', 'url' => '/session/:sessionId/element/:id/element'],
|
||||
DriverCommand::FIND_CHILD_ELEMENTS => ['method' => 'POST', 'url' => '/session/:sessionId/element/:id/elements'],
|
||||
DriverCommand::EXECUTE_SCRIPT => ['method' => 'POST', 'url' => '/session/:sessionId/execute'],
|
||||
DriverCommand::EXECUTE_ASYNC_SCRIPT => ['method' => 'POST', 'url' => '/session/:sessionId/execute_async'],
|
||||
DriverCommand::FIND_ELEMENT => ['method' => 'POST', 'url' => '/session/:sessionId/element'],
|
||||
DriverCommand::FIND_ELEMENTS => ['method' => 'POST', 'url' => '/session/:sessionId/elements'],
|
||||
DriverCommand::SWITCH_TO_FRAME => ['method' => 'POST', 'url' => '/session/:sessionId/frame'],
|
||||
DriverCommand::SWITCH_TO_WINDOW => ['method' => 'POST', 'url' => '/session/:sessionId/window'],
|
||||
DriverCommand::GET => ['method' => 'POST', 'url' => '/session/:sessionId/url'],
|
||||
DriverCommand::GET_ACTIVE_ELEMENT => ['method' => 'POST', 'url' => '/session/:sessionId/element/active'],
|
||||
DriverCommand::GET_ALERT_TEXT => ['method' => 'GET', 'url' => '/session/:sessionId/alert_text'],
|
||||
DriverCommand::GET_ALL_COOKIES => ['method' => 'GET', 'url' => '/session/:sessionId/cookie'],
|
||||
DriverCommand::GET_ALL_SESSIONS => ['method' => 'GET', 'url' => '/sessions'],
|
||||
DriverCommand::GET_AVAILABLE_LOG_TYPES => ['method' => 'GET', 'url' => '/session/:sessionId/log/types'],
|
||||
DriverCommand::GET_CURRENT_URL => ['method' => 'GET', 'url' => '/session/:sessionId/url'],
|
||||
DriverCommand::GET_CURRENT_WINDOW_HANDLE => ['method' => 'GET', 'url' => '/session/:sessionId/window_handle'],
|
||||
DriverCommand::GET_ELEMENT_ATTRIBUTE => [
|
||||
'method' => 'GET',
|
||||
'url' => '/session/:sessionId/element/:id/attribute/:name',
|
||||
],
|
||||
DriverCommand::GET_ELEMENT_VALUE_OF_CSS_PROPERTY => [
|
||||
'method' => 'GET',
|
||||
'url' => '/session/:sessionId/element/:id/css/:propertyName',
|
||||
],
|
||||
DriverCommand::GET_ELEMENT_LOCATION => [
|
||||
'method' => 'GET',
|
||||
'url' => '/session/:sessionId/element/:id/location',
|
||||
],
|
||||
DriverCommand::GET_ELEMENT_LOCATION_ONCE_SCROLLED_INTO_VIEW => [
|
||||
'method' => 'GET',
|
||||
'url' => '/session/:sessionId/element/:id/location_in_view',
|
||||
],
|
||||
DriverCommand::GET_ELEMENT_SIZE => ['method' => 'GET', 'url' => '/session/:sessionId/element/:id/size'],
|
||||
DriverCommand::GET_ELEMENT_TAG_NAME => ['method' => 'GET', 'url' => '/session/:sessionId/element/:id/name'],
|
||||
DriverCommand::GET_ELEMENT_TEXT => ['method' => 'GET', 'url' => '/session/:sessionId/element/:id/text'],
|
||||
DriverCommand::GET_LOG => ['method' => 'POST', 'url' => '/session/:sessionId/log'],
|
||||
DriverCommand::GET_PAGE_SOURCE => ['method' => 'GET', 'url' => '/session/:sessionId/source'],
|
||||
DriverCommand::GET_SCREEN_ORIENTATION => ['method' => 'GET', 'url' => '/session/:sessionId/orientation'],
|
||||
DriverCommand::GET_CAPABILITIES => ['method' => 'GET', 'url' => '/session/:sessionId'],
|
||||
DriverCommand::GET_TITLE => ['method' => 'GET', 'url' => '/session/:sessionId/title'],
|
||||
DriverCommand::GET_WINDOW_HANDLES => ['method' => 'GET', 'url' => '/session/:sessionId/window_handles'],
|
||||
DriverCommand::GET_WINDOW_POSITION => [
|
||||
'method' => 'GET',
|
||||
'url' => '/session/:sessionId/window/:windowHandle/position',
|
||||
],
|
||||
DriverCommand::GET_WINDOW_SIZE => ['method' => 'GET', 'url' => '/session/:sessionId/window/:windowHandle/size'],
|
||||
DriverCommand::GO_BACK => ['method' => 'POST', 'url' => '/session/:sessionId/back'],
|
||||
DriverCommand::GO_FORWARD => ['method' => 'POST', 'url' => '/session/:sessionId/forward'],
|
||||
DriverCommand::IS_ELEMENT_DISPLAYED => [
|
||||
'method' => 'GET',
|
||||
'url' => '/session/:sessionId/element/:id/displayed',
|
||||
],
|
||||
DriverCommand::IS_ELEMENT_ENABLED => ['method' => 'GET', 'url' => '/session/:sessionId/element/:id/enabled'],
|
||||
DriverCommand::IS_ELEMENT_SELECTED => ['method' => 'GET', 'url' => '/session/:sessionId/element/:id/selected'],
|
||||
DriverCommand::MAXIMIZE_WINDOW => [
|
||||
'method' => 'POST',
|
||||
'url' => '/session/:sessionId/window/:windowHandle/maximize',
|
||||
],
|
||||
DriverCommand::MOUSE_DOWN => ['method' => 'POST', 'url' => '/session/:sessionId/buttondown'],
|
||||
DriverCommand::MOUSE_UP => ['method' => 'POST', 'url' => '/session/:sessionId/buttonup'],
|
||||
DriverCommand::CLICK => ['method' => 'POST', 'url' => '/session/:sessionId/click'],
|
||||
DriverCommand::DOUBLE_CLICK => ['method' => 'POST', 'url' => '/session/:sessionId/doubleclick'],
|
||||
DriverCommand::MOVE_TO => ['method' => 'POST', 'url' => '/session/:sessionId/moveto'],
|
||||
DriverCommand::NEW_SESSION => ['method' => 'POST', 'url' => '/session'],
|
||||
DriverCommand::QUIT => ['method' => 'DELETE', 'url' => '/session/:sessionId'],
|
||||
DriverCommand::REFRESH => ['method' => 'POST', 'url' => '/session/:sessionId/refresh'],
|
||||
DriverCommand::UPLOAD_FILE => ['method' => 'POST', 'url' => '/session/:sessionId/file'], // undocumented
|
||||
DriverCommand::SEND_KEYS_TO_ACTIVE_ELEMENT => ['method' => 'POST', 'url' => '/session/:sessionId/keys'],
|
||||
DriverCommand::SET_ALERT_VALUE => ['method' => 'POST', 'url' => '/session/:sessionId/alert_text'],
|
||||
DriverCommand::SEND_KEYS_TO_ELEMENT => ['method' => 'POST', 'url' => '/session/:sessionId/element/:id/value'],
|
||||
DriverCommand::IMPLICITLY_WAIT => ['method' => 'POST', 'url' => '/session/:sessionId/timeouts/implicit_wait'],
|
||||
DriverCommand::SET_SCREEN_ORIENTATION => ['method' => 'POST', 'url' => '/session/:sessionId/orientation'],
|
||||
DriverCommand::SET_TIMEOUT => ['method' => 'POST', 'url' => '/session/:sessionId/timeouts'],
|
||||
DriverCommand::SET_SCRIPT_TIMEOUT => ['method' => 'POST', 'url' => '/session/:sessionId/timeouts/async_script'],
|
||||
DriverCommand::SET_WINDOW_POSITION => [
|
||||
'method' => 'POST',
|
||||
'url' => '/session/:sessionId/window/:windowHandle/position',
|
||||
],
|
||||
DriverCommand::SET_WINDOW_SIZE => [
|
||||
'method' => 'POST',
|
||||
'url' => '/session/:sessionId/window/:windowHandle/size',
|
||||
],
|
||||
DriverCommand::SUBMIT_ELEMENT => ['method' => 'POST', 'url' => '/session/:sessionId/element/:id/submit'],
|
||||
DriverCommand::SCREENSHOT => ['method' => 'GET', 'url' => '/session/:sessionId/screenshot'],
|
||||
DriverCommand::TOUCH_SINGLE_TAP => ['method' => 'POST', 'url' => '/session/:sessionId/touch/click'],
|
||||
DriverCommand::TOUCH_DOWN => ['method' => 'POST', 'url' => '/session/:sessionId/touch/down'],
|
||||
DriverCommand::TOUCH_DOUBLE_TAP => ['method' => 'POST', 'url' => '/session/:sessionId/touch/doubleclick'],
|
||||
DriverCommand::TOUCH_FLICK => ['method' => 'POST', 'url' => '/session/:sessionId/touch/flick'],
|
||||
DriverCommand::TOUCH_LONG_PRESS => ['method' => 'POST', 'url' => '/session/:sessionId/touch/longclick'],
|
||||
DriverCommand::TOUCH_MOVE => ['method' => 'POST', 'url' => '/session/:sessionId/touch/move'],
|
||||
DriverCommand::TOUCH_SCROLL => ['method' => 'POST', 'url' => '/session/:sessionId/touch/scroll'],
|
||||
DriverCommand::TOUCH_UP => ['method' => 'POST', 'url' => '/session/:sessionId/touch/up'],
|
||||
];
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $url;
|
||||
/**
|
||||
* @var resource
|
||||
*/
|
||||
protected $curl;
|
||||
|
||||
/**
|
||||
* @param string $url
|
||||
* @param string|null $http_proxy
|
||||
* @param int|null $http_proxy_port
|
||||
*/
|
||||
public function __construct($url, $http_proxy = null, $http_proxy_port = null)
|
||||
{
|
||||
$this->url = $url;
|
||||
$this->curl = curl_init();
|
||||
|
||||
if (!empty($http_proxy)) {
|
||||
curl_setopt($this->curl, CURLOPT_PROXY, $http_proxy);
|
||||
if ($http_proxy_port !== null) {
|
||||
curl_setopt($this->curl, CURLOPT_PROXYPORT, $http_proxy_port);
|
||||
}
|
||||
}
|
||||
|
||||
// Get credentials from $url (if any)
|
||||
$matches = null;
|
||||
if (preg_match("/^(https?:\/\/)(.*):(.*)@(.*?)/U", $url, $matches)) {
|
||||
$this->url = $matches[1] . $matches[4];
|
||||
$auth_creds = $matches[2] . ':' . $matches[3];
|
||||
curl_setopt($this->curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
|
||||
curl_setopt($this->curl, CURLOPT_USERPWD, $auth_creds);
|
||||
}
|
||||
|
||||
curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, true);
|
||||
curl_setopt($this->curl, CURLOPT_HTTPHEADER, static::DEFAULT_HTTP_HEADERS);
|
||||
$this->setRequestTimeout(30000);
|
||||
$this->setConnectionTimeout(30000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set timeout for the connect phase
|
||||
*
|
||||
* @param int $timeout_in_ms Timeout in milliseconds
|
||||
* @return HttpCommandExecutor
|
||||
*/
|
||||
public function setConnectionTimeout($timeout_in_ms)
|
||||
{
|
||||
// There is a PHP bug in some versions which didn't define the constant.
|
||||
curl_setopt(
|
||||
$this->curl,
|
||||
/* CURLOPT_CONNECTTIMEOUT_MS */
|
||||
156,
|
||||
$timeout_in_ms
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the maximum time of a request
|
||||
*
|
||||
* @param int $timeout_in_ms Timeout in milliseconds
|
||||
* @return HttpCommandExecutor
|
||||
*/
|
||||
public function setRequestTimeout($timeout_in_ms)
|
||||
{
|
||||
// There is a PHP bug in some versions (at least for PHP 5.3.3) which
|
||||
// didn't define the constant.
|
||||
curl_setopt(
|
||||
$this->curl,
|
||||
/* CURLOPT_TIMEOUT_MS */
|
||||
155,
|
||||
$timeout_in_ms
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverCommand $command
|
||||
*
|
||||
* @throws WebDriverException
|
||||
* @return WebDriverResponse
|
||||
*/
|
||||
public function execute(WebDriverCommand $command)
|
||||
{
|
||||
if (!isset(self::$commands[$command->getName()])) {
|
||||
throw new InvalidArgumentException($command->getName() . ' is not a valid command.');
|
||||
}
|
||||
|
||||
$raw = self::$commands[$command->getName()];
|
||||
$http_method = $raw['method'];
|
||||
$url = $raw['url'];
|
||||
$url = str_replace(':sessionId', $command->getSessionID(), $url);
|
||||
$params = $command->getParameters();
|
||||
foreach ($params as $name => $value) {
|
||||
if ($name[0] === ':') {
|
||||
$url = str_replace($name, $value, $url);
|
||||
unset($params[$name]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($params && is_array($params) && $http_method !== 'POST') {
|
||||
throw new BadMethodCallException(sprintf(
|
||||
'The http method called for %s is %s but it has to be POST' .
|
||||
' if you want to pass the JSON params %s',
|
||||
$url,
|
||||
$http_method,
|
||||
json_encode($params)
|
||||
));
|
||||
}
|
||||
|
||||
curl_setopt($this->curl, CURLOPT_URL, $this->url . $url);
|
||||
|
||||
// https://github.com/facebook/php-webdriver/issues/173
|
||||
if ($command->getName() === DriverCommand::NEW_SESSION) {
|
||||
curl_setopt($this->curl, CURLOPT_POST, 1);
|
||||
} else {
|
||||
curl_setopt($this->curl, CURLOPT_CUSTOMREQUEST, $http_method);
|
||||
}
|
||||
|
||||
if (in_array($http_method, ['POST', 'PUT'])) {
|
||||
// Disable sending 'Expect: 100-Continue' header, as it is causing issues with eg. squid proxy
|
||||
// https://tools.ietf.org/html/rfc7231#section-5.1.1
|
||||
curl_setopt($this->curl, CURLOPT_HTTPHEADER, array_merge(static::DEFAULT_HTTP_HEADERS, ['Expect:']));
|
||||
} else {
|
||||
curl_setopt($this->curl, CURLOPT_HTTPHEADER, static::DEFAULT_HTTP_HEADERS);
|
||||
}
|
||||
|
||||
$encoded_params = null;
|
||||
|
||||
if ($http_method === 'POST' && $params && is_array($params)) {
|
||||
$encoded_params = json_encode($params);
|
||||
}
|
||||
|
||||
curl_setopt($this->curl, CURLOPT_POSTFIELDS, $encoded_params);
|
||||
|
||||
$raw_results = trim(curl_exec($this->curl));
|
||||
|
||||
if ($error = curl_error($this->curl)) {
|
||||
$msg = sprintf(
|
||||
'Curl error thrown for http %s to %s',
|
||||
$http_method,
|
||||
$url
|
||||
);
|
||||
if ($params && is_array($params)) {
|
||||
$msg .= sprintf(' with params: %s', json_encode($params));
|
||||
}
|
||||
|
||||
throw new WebDriverCurlException($msg . "\n\n" . $error);
|
||||
}
|
||||
|
||||
$results = json_decode($raw_results, true);
|
||||
|
||||
if ($results === null && json_last_error() !== JSON_ERROR_NONE) {
|
||||
throw new WebDriverException(
|
||||
sprintf(
|
||||
"JSON decoding of remote response failed.\n" .
|
||||
"Error code: %d\n" .
|
||||
"The response: '%s'\n",
|
||||
json_last_error(),
|
||||
$raw_results
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$value = null;
|
||||
if (is_array($results) && array_key_exists('value', $results)) {
|
||||
$value = $results['value'];
|
||||
}
|
||||
|
||||
$message = null;
|
||||
if (is_array($value) && array_key_exists('message', $value)) {
|
||||
$message = $value['message'];
|
||||
}
|
||||
|
||||
$sessionId = null;
|
||||
if (is_array($results) && array_key_exists('sessionId', $results)) {
|
||||
$sessionId = $results['sessionId'];
|
||||
}
|
||||
|
||||
$status = isset($results['status']) ? $results['status'] : 0;
|
||||
if ($status != 0) {
|
||||
WebDriverException::throwException($status, $message, $results);
|
||||
}
|
||||
|
||||
$response = new WebDriverResponse($sessionId);
|
||||
|
||||
return $response
|
||||
->setStatus($status)
|
||||
->setValue($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAddressOfRemoteServer()
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
}
|
||||
33
vendor/facebook/webdriver/lib/Remote/LocalFileDetector.php
vendored
Normal file
33
vendor/facebook/webdriver/lib/Remote/LocalFileDetector.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Remote;
|
||||
|
||||
class LocalFileDetector implements FileDetector
|
||||
{
|
||||
/**
|
||||
* @param string $file
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function getLocalFile($file)
|
||||
{
|
||||
if (is_file($file)) {
|
||||
return $file;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
42
vendor/facebook/webdriver/lib/Remote/RemoteExecuteMethod.php
vendored
Normal file
42
vendor/facebook/webdriver/lib/Remote/RemoteExecuteMethod.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Remote;
|
||||
|
||||
class RemoteExecuteMethod implements ExecuteMethod
|
||||
{
|
||||
/**
|
||||
* @var RemoteWebDriver
|
||||
*/
|
||||
private $driver;
|
||||
|
||||
/**
|
||||
* @param RemoteWebDriver $driver
|
||||
*/
|
||||
public function __construct(RemoteWebDriver $driver)
|
||||
{
|
||||
$this->driver = $driver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $command_name
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public function execute($command_name, array $parameters = [])
|
||||
{
|
||||
return $this->driver->execute($command_name, $parameters);
|
||||
}
|
||||
}
|
||||
84
vendor/facebook/webdriver/lib/Remote/RemoteKeyboard.php
vendored
Normal file
84
vendor/facebook/webdriver/lib/Remote/RemoteKeyboard.php
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Remote;
|
||||
|
||||
use Facebook\WebDriver\WebDriverKeyboard;
|
||||
use Facebook\WebDriver\WebDriverKeys;
|
||||
|
||||
/**
|
||||
* Execute keyboard commands for RemoteWebDriver.
|
||||
*/
|
||||
class RemoteKeyboard implements WebDriverKeyboard
|
||||
{
|
||||
/**
|
||||
* @var RemoteExecuteMethod
|
||||
*/
|
||||
private $executor;
|
||||
|
||||
/**
|
||||
* @param RemoteExecuteMethod $executor
|
||||
*/
|
||||
public function __construct(RemoteExecuteMethod $executor)
|
||||
{
|
||||
$this->executor = $executor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send keys to active element
|
||||
* @param string|array $keys
|
||||
* @return $this
|
||||
*/
|
||||
public function sendKeys($keys)
|
||||
{
|
||||
$this->executor->execute(DriverCommand::SEND_KEYS_TO_ACTIVE_ELEMENT, [
|
||||
'value' => WebDriverKeys::encode($keys),
|
||||
]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Press a modifier key
|
||||
*
|
||||
* @see WebDriverKeys
|
||||
* @param string $key
|
||||
* @return $this
|
||||
*/
|
||||
public function pressKey($key)
|
||||
{
|
||||
$this->executor->execute(DriverCommand::SEND_KEYS_TO_ACTIVE_ELEMENT, [
|
||||
'value' => [(string) $key],
|
||||
]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Release a modifier key
|
||||
*
|
||||
* @see WebDriverKeys
|
||||
* @param string $key
|
||||
* @return $this
|
||||
*/
|
||||
public function releaseKey($key)
|
||||
{
|
||||
$this->executor->execute(DriverCommand::SEND_KEYS_TO_ACTIVE_ELEMENT, [
|
||||
'value' => [(string) $key],
|
||||
]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
144
vendor/facebook/webdriver/lib/Remote/RemoteMouse.php
vendored
Normal file
144
vendor/facebook/webdriver/lib/Remote/RemoteMouse.php
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Remote;
|
||||
|
||||
use Facebook\WebDriver\Interactions\Internal\WebDriverCoordinates;
|
||||
use Facebook\WebDriver\WebDriverMouse;
|
||||
|
||||
/**
|
||||
* Execute mouse commands for RemoteWebDriver.
|
||||
*/
|
||||
class RemoteMouse implements WebDriverMouse
|
||||
{
|
||||
/**
|
||||
* @var RemoteExecuteMethod
|
||||
*/
|
||||
private $executor;
|
||||
|
||||
/**
|
||||
* @param RemoteExecuteMethod $executor
|
||||
*/
|
||||
public function __construct(RemoteExecuteMethod $executor)
|
||||
{
|
||||
$this->executor = $executor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|WebDriverCoordinates $where
|
||||
*
|
||||
* @return RemoteMouse
|
||||
*/
|
||||
public function click(WebDriverCoordinates $where = null)
|
||||
{
|
||||
$this->moveIfNeeded($where);
|
||||
$this->executor->execute(DriverCommand::CLICK, [
|
||||
'button' => 0,
|
||||
]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverCoordinates $where
|
||||
*
|
||||
* @return RemoteMouse
|
||||
*/
|
||||
public function contextClick(WebDriverCoordinates $where = null)
|
||||
{
|
||||
$this->moveIfNeeded($where);
|
||||
$this->executor->execute(DriverCommand::CLICK, [
|
||||
'button' => 2,
|
||||
]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverCoordinates $where
|
||||
*
|
||||
* @return RemoteMouse
|
||||
*/
|
||||
public function doubleClick(WebDriverCoordinates $where = null)
|
||||
{
|
||||
$this->moveIfNeeded($where);
|
||||
$this->executor->execute(DriverCommand::DOUBLE_CLICK);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverCoordinates $where
|
||||
*
|
||||
* @return RemoteMouse
|
||||
*/
|
||||
public function mouseDown(WebDriverCoordinates $where = null)
|
||||
{
|
||||
$this->moveIfNeeded($where);
|
||||
$this->executor->execute(DriverCommand::MOUSE_DOWN);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverCoordinates $where
|
||||
* @param int|null $x_offset
|
||||
* @param int|null $y_offset
|
||||
*
|
||||
* @return RemoteMouse
|
||||
*/
|
||||
public function mouseMove(
|
||||
WebDriverCoordinates $where = null,
|
||||
$x_offset = null,
|
||||
$y_offset = null
|
||||
) {
|
||||
$params = [];
|
||||
if ($where !== null) {
|
||||
$params['element'] = $where->getAuxiliary();
|
||||
}
|
||||
if ($x_offset !== null) {
|
||||
$params['xoffset'] = $x_offset;
|
||||
}
|
||||
if ($y_offset !== null) {
|
||||
$params['yoffset'] = $y_offset;
|
||||
}
|
||||
$this->executor->execute(DriverCommand::MOVE_TO, $params);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverCoordinates $where
|
||||
*
|
||||
* @return RemoteMouse
|
||||
*/
|
||||
public function mouseUp(WebDriverCoordinates $where = null)
|
||||
{
|
||||
$this->moveIfNeeded($where);
|
||||
$this->executor->execute(DriverCommand::MOUSE_UP);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverCoordinates $where
|
||||
*/
|
||||
protected function moveIfNeeded(WebDriverCoordinates $where = null)
|
||||
{
|
||||
if ($where) {
|
||||
$this->mouseMove($where);
|
||||
}
|
||||
}
|
||||
}
|
||||
117
vendor/facebook/webdriver/lib/Remote/RemoteTargetLocator.php
vendored
Normal file
117
vendor/facebook/webdriver/lib/Remote/RemoteTargetLocator.php
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Remote;
|
||||
|
||||
use Facebook\WebDriver\WebDriver;
|
||||
use Facebook\WebDriver\WebDriverAlert;
|
||||
use Facebook\WebDriver\WebDriverElement;
|
||||
use Facebook\WebDriver\WebDriverTargetLocator;
|
||||
|
||||
/**
|
||||
* Used to locate a given frame or window for RemoteWebDriver.
|
||||
*/
|
||||
class RemoteTargetLocator implements WebDriverTargetLocator
|
||||
{
|
||||
/**
|
||||
* @var ExecuteMethod
|
||||
*/
|
||||
protected $executor;
|
||||
/**
|
||||
* @var WebDriver
|
||||
*/
|
||||
protected $driver;
|
||||
|
||||
public function __construct($executor, $driver)
|
||||
{
|
||||
$this->executor = $executor;
|
||||
$this->driver = $driver;
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch to the main document if the page contains iframes. Otherwise, switch
|
||||
* to the first frame on the page.
|
||||
*
|
||||
* @return WebDriver The driver focused on the top window or the first frame.
|
||||
*/
|
||||
public function defaultContent()
|
||||
{
|
||||
$params = ['id' => null];
|
||||
$this->executor->execute(DriverCommand::SWITCH_TO_FRAME, $params);
|
||||
|
||||
return $this->driver;
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch to the iframe by its id or name.
|
||||
*
|
||||
* @param WebDriverElement|string $frame The WebDriverElement,
|
||||
* the id or the name of the frame.
|
||||
* @return WebDriver The driver focused on the given frame.
|
||||
*/
|
||||
public function frame($frame)
|
||||
{
|
||||
if ($frame instanceof WebDriverElement) {
|
||||
$id = ['ELEMENT' => $frame->getID()];
|
||||
} else {
|
||||
$id = (string) $frame;
|
||||
}
|
||||
|
||||
$params = ['id' => $id];
|
||||
$this->executor->execute(DriverCommand::SWITCH_TO_FRAME, $params);
|
||||
|
||||
return $this->driver;
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch the focus to another window by its handle.
|
||||
*
|
||||
* @param string $handle The handle of the window to be focused on.
|
||||
* @return WebDriver The driver focused on the given window.
|
||||
* @see WebDriver::getWindowHandles
|
||||
*/
|
||||
public function window($handle)
|
||||
{
|
||||
$params = ['name' => (string) $handle];
|
||||
$this->executor->execute(DriverCommand::SWITCH_TO_WINDOW, $params);
|
||||
|
||||
return $this->driver;
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch to the currently active modal dialog for this particular driver
|
||||
* instance.
|
||||
*
|
||||
* @return WebDriverAlert
|
||||
*/
|
||||
public function alert()
|
||||
{
|
||||
return new WebDriverAlert($this->executor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches to the element that currently has focus within the document
|
||||
* currently "switched to", or the body element if this cannot be detected.
|
||||
*
|
||||
* @return RemoteWebElement
|
||||
*/
|
||||
public function activeElement()
|
||||
{
|
||||
$response = $this->driver->execute(DriverCommand::GET_ACTIVE_ELEMENT, []);
|
||||
$method = new RemoteExecuteMethod($this->driver);
|
||||
|
||||
return new RemoteWebElement($method, $response['ELEMENT']);
|
||||
}
|
||||
}
|
||||
201
vendor/facebook/webdriver/lib/Remote/RemoteTouchScreen.php
vendored
Normal file
201
vendor/facebook/webdriver/lib/Remote/RemoteTouchScreen.php
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Remote;
|
||||
|
||||
use Facebook\WebDriver\Interactions\Touch\WebDriverTouchScreen;
|
||||
use Facebook\WebDriver\WebDriverElement;
|
||||
|
||||
/**
|
||||
* Execute touch commands for RemoteWebDriver.
|
||||
*/
|
||||
class RemoteTouchScreen implements WebDriverTouchScreen
|
||||
{
|
||||
/**
|
||||
* @var RemoteExecuteMethod
|
||||
*/
|
||||
private $executor;
|
||||
|
||||
/**
|
||||
* @param RemoteExecuteMethod $executor
|
||||
*/
|
||||
public function __construct(RemoteExecuteMethod $executor)
|
||||
{
|
||||
$this->executor = $executor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverElement $element
|
||||
*
|
||||
* @return RemoteTouchScreen The instance.
|
||||
*/
|
||||
public function tap(WebDriverElement $element)
|
||||
{
|
||||
$this->executor->execute(
|
||||
DriverCommand::TOUCH_SINGLE_TAP,
|
||||
['element' => $element->getID()]
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverElement $element
|
||||
*
|
||||
* @return RemoteTouchScreen The instance.
|
||||
*/
|
||||
public function doubleTap(WebDriverElement $element)
|
||||
{
|
||||
$this->executor->execute(
|
||||
DriverCommand::TOUCH_DOUBLE_TAP,
|
||||
['element' => $element->getID()]
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
*
|
||||
* @return RemoteTouchScreen The instance.
|
||||
*/
|
||||
public function down($x, $y)
|
||||
{
|
||||
$this->executor->execute(DriverCommand::TOUCH_DOWN, [
|
||||
'x' => $x,
|
||||
'y' => $y,
|
||||
]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $xspeed
|
||||
* @param int $yspeed
|
||||
*
|
||||
* @return RemoteTouchScreen The instance.
|
||||
*/
|
||||
public function flick($xspeed, $yspeed)
|
||||
{
|
||||
$this->executor->execute(DriverCommand::TOUCH_FLICK, [
|
||||
'xspeed' => $xspeed,
|
||||
'yspeed' => $yspeed,
|
||||
]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverElement $element
|
||||
* @param int $xoffset
|
||||
* @param int $yoffset
|
||||
* @param int $speed
|
||||
*
|
||||
* @return RemoteTouchScreen The instance.
|
||||
*/
|
||||
public function flickFromElement(WebDriverElement $element, $xoffset, $yoffset, $speed)
|
||||
{
|
||||
$this->executor->execute(DriverCommand::TOUCH_FLICK, [
|
||||
'xoffset' => $xoffset,
|
||||
'yoffset' => $yoffset,
|
||||
'element' => $element->getID(),
|
||||
'speed' => $speed,
|
||||
]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverElement $element
|
||||
*
|
||||
* @return RemoteTouchScreen The instance.
|
||||
*/
|
||||
public function longPress(WebDriverElement $element)
|
||||
{
|
||||
$this->executor->execute(
|
||||
DriverCommand::TOUCH_LONG_PRESS,
|
||||
['element' => $element->getID()]
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
*
|
||||
* @return RemoteTouchScreen The instance.
|
||||
*/
|
||||
public function move($x, $y)
|
||||
{
|
||||
$this->executor->execute(DriverCommand::TOUCH_MOVE, [
|
||||
'x' => $x,
|
||||
'y' => $y,
|
||||
]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $xoffset
|
||||
* @param int $yoffset
|
||||
*
|
||||
* @return RemoteTouchScreen The instance.
|
||||
*/
|
||||
public function scroll($xoffset, $yoffset)
|
||||
{
|
||||
$this->executor->execute(DriverCommand::TOUCH_SCROLL, [
|
||||
'xoffset' => $xoffset,
|
||||
'yoffset' => $yoffset,
|
||||
]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverElement $element
|
||||
* @param int $xoffset
|
||||
* @param int $yoffset
|
||||
*
|
||||
* @return RemoteTouchScreen The instance.
|
||||
*/
|
||||
public function scrollFromElement(WebDriverElement $element, $xoffset, $yoffset)
|
||||
{
|
||||
$this->executor->execute(DriverCommand::TOUCH_SCROLL, [
|
||||
'element' => $element->getID(),
|
||||
'xoffset' => $xoffset,
|
||||
'yoffset' => $yoffset,
|
||||
]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
*
|
||||
* @return RemoteTouchScreen The instance.
|
||||
*/
|
||||
public function up($x, $y)
|
||||
{
|
||||
$this->executor->execute(DriverCommand::TOUCH_UP, [
|
||||
'x' => $x,
|
||||
'y' => $y,
|
||||
]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
620
vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php
vendored
Normal file
620
vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php
vendored
Normal file
@@ -0,0 +1,620 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Remote;
|
||||
|
||||
use Facebook\WebDriver\Interactions\WebDriverActions;
|
||||
use Facebook\WebDriver\JavaScriptExecutor;
|
||||
use Facebook\WebDriver\WebDriver;
|
||||
use Facebook\WebDriver\WebDriverBy;
|
||||
use Facebook\WebDriver\WebDriverCapabilities;
|
||||
use Facebook\WebDriver\WebDriverCommandExecutor;
|
||||
use Facebook\WebDriver\WebDriverElement;
|
||||
use Facebook\WebDriver\WebDriverHasInputDevices;
|
||||
use Facebook\WebDriver\WebDriverNavigation;
|
||||
use Facebook\WebDriver\WebDriverOptions;
|
||||
use Facebook\WebDriver\WebDriverWait;
|
||||
|
||||
class RemoteWebDriver implements WebDriver, JavaScriptExecutor, WebDriverHasInputDevices
|
||||
{
|
||||
/**
|
||||
* @var HttpCommandExecutor|null
|
||||
*/
|
||||
protected $executor;
|
||||
/**
|
||||
* @var WebDriverCapabilities
|
||||
*/
|
||||
protected $capabilities;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $sessionID;
|
||||
/**
|
||||
* @var RemoteMouse
|
||||
*/
|
||||
protected $mouse;
|
||||
/**
|
||||
* @var RemoteKeyboard
|
||||
*/
|
||||
protected $keyboard;
|
||||
/**
|
||||
* @var RemoteTouchScreen
|
||||
*/
|
||||
protected $touch;
|
||||
/**
|
||||
* @var RemoteExecuteMethod
|
||||
*/
|
||||
protected $executeMethod;
|
||||
|
||||
/**
|
||||
* @param HttpCommandExecutor $commandExecutor
|
||||
* @param string $sessionId
|
||||
* @param WebDriverCapabilities|null $capabilities
|
||||
*/
|
||||
protected function __construct(
|
||||
HttpCommandExecutor $commandExecutor,
|
||||
$sessionId,
|
||||
WebDriverCapabilities $capabilities = null
|
||||
) {
|
||||
$this->executor = $commandExecutor;
|
||||
$this->sessionID = $sessionId;
|
||||
|
||||
if ($capabilities !== null) {
|
||||
$this->capabilities = $capabilities;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct the RemoteWebDriver by a desired capabilities.
|
||||
*
|
||||
* @param string $selenium_server_url The url of the remote Selenium WebDriver server
|
||||
* @param DesiredCapabilities|array $desired_capabilities The desired capabilities
|
||||
* @param int|null $connection_timeout_in_ms Set timeout for the connect phase to remote Selenium WebDriver server
|
||||
* @param int|null $request_timeout_in_ms Set the maximum time of a request to remote Selenium WebDriver server
|
||||
* @param string|null $http_proxy The proxy to tunnel requests to the remote Selenium WebDriver through
|
||||
* @param int|null $http_proxy_port The proxy port to tunnel requests to the remote Selenium WebDriver through
|
||||
* @param DesiredCapabilities $required_capabilities The required capabilities
|
||||
* @return static
|
||||
*/
|
||||
public static function create(
|
||||
$selenium_server_url = 'http://localhost:4444/wd/hub',
|
||||
$desired_capabilities = null,
|
||||
$connection_timeout_in_ms = null,
|
||||
$request_timeout_in_ms = null,
|
||||
$http_proxy = null,
|
||||
$http_proxy_port = null,
|
||||
DesiredCapabilities $required_capabilities = null
|
||||
) {
|
||||
$selenium_server_url = preg_replace('#/+$#', '', $selenium_server_url);
|
||||
|
||||
$desired_capabilities = self::castToDesiredCapabilitiesObject($desired_capabilities);
|
||||
|
||||
$executor = new HttpCommandExecutor($selenium_server_url, $http_proxy, $http_proxy_port);
|
||||
if ($connection_timeout_in_ms !== null) {
|
||||
$executor->setConnectionTimeout($connection_timeout_in_ms);
|
||||
}
|
||||
if ($request_timeout_in_ms !== null) {
|
||||
$executor->setRequestTimeout($request_timeout_in_ms);
|
||||
}
|
||||
|
||||
if ($required_capabilities !== null) {
|
||||
// TODO: Selenium (as of v3.0.1) does accept requiredCapabilities only as a property of desiredCapabilities.
|
||||
// This will probably change in future with the W3C WebDriver spec, but is the only way how to pass these
|
||||
// values now.
|
||||
$desired_capabilities->setCapability('requiredCapabilities', $required_capabilities->toArray());
|
||||
}
|
||||
|
||||
$command = new WebDriverCommand(
|
||||
null,
|
||||
DriverCommand::NEW_SESSION,
|
||||
['desiredCapabilities' => $desired_capabilities->toArray()]
|
||||
);
|
||||
|
||||
$response = $executor->execute($command);
|
||||
$returnedCapabilities = new DesiredCapabilities($response->getValue());
|
||||
|
||||
$driver = new static($executor, $response->getSessionID(), $returnedCapabilities);
|
||||
|
||||
return $driver;
|
||||
}
|
||||
|
||||
/**
|
||||
* [Experimental] Construct the RemoteWebDriver by an existing session.
|
||||
*
|
||||
* This constructor can boost the performance a lot by reusing the same browser for the whole test suite.
|
||||
* You cannot pass the desired capabilities because the session was created before.
|
||||
*
|
||||
* @param string $selenium_server_url The url of the remote Selenium WebDriver server
|
||||
* @param string $session_id The existing session id
|
||||
* @param int|null $connection_timeout_in_ms Set timeout for the connect phase to remote Selenium WebDriver server
|
||||
* @param int|null $request_timeout_in_ms Set the maximum time of a request to remote Selenium WebDriver server
|
||||
* @return static
|
||||
*/
|
||||
public static function createBySessionID(
|
||||
$session_id,
|
||||
$selenium_server_url = 'http://localhost:4444/wd/hub',
|
||||
$connection_timeout_in_ms = null,
|
||||
$request_timeout_in_ms = null
|
||||
) {
|
||||
$executor = new HttpCommandExecutor($selenium_server_url);
|
||||
if ($connection_timeout_in_ms !== null) {
|
||||
$executor->setConnectionTimeout($connection_timeout_in_ms);
|
||||
}
|
||||
if ($request_timeout_in_ms !== null) {
|
||||
$executor->setRequestTimeout($request_timeout_in_ms);
|
||||
}
|
||||
|
||||
return new static($executor, $session_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the current window.
|
||||
*
|
||||
* @return RemoteWebDriver The current instance.
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
$this->execute(DriverCommand::CLOSE, []);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the first WebDriverElement using the given mechanism.
|
||||
*
|
||||
* @param WebDriverBy $by
|
||||
* @return RemoteWebElement NoSuchElementException is thrown in HttpCommandExecutor if no element is found.
|
||||
* @see WebDriverBy
|
||||
*/
|
||||
public function findElement(WebDriverBy $by)
|
||||
{
|
||||
$params = ['using' => $by->getMechanism(), 'value' => $by->getValue()];
|
||||
$raw_element = $this->execute(
|
||||
DriverCommand::FIND_ELEMENT,
|
||||
$params
|
||||
);
|
||||
|
||||
return $this->newElement($raw_element['ELEMENT']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find all WebDriverElements within the current page using the given mechanism.
|
||||
*
|
||||
* @param WebDriverBy $by
|
||||
* @return RemoteWebElement[] A list of all WebDriverElements, or an empty array if nothing matches
|
||||
* @see WebDriverBy
|
||||
*/
|
||||
public function findElements(WebDriverBy $by)
|
||||
{
|
||||
$params = ['using' => $by->getMechanism(), 'value' => $by->getValue()];
|
||||
$raw_elements = $this->execute(
|
||||
DriverCommand::FIND_ELEMENTS,
|
||||
$params
|
||||
);
|
||||
|
||||
$elements = [];
|
||||
foreach ($raw_elements as $raw_element) {
|
||||
$elements[] = $this->newElement($raw_element['ELEMENT']);
|
||||
}
|
||||
|
||||
return $elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a new web page in the current browser window.
|
||||
*
|
||||
* @param string $url
|
||||
*
|
||||
* @return RemoteWebDriver The current instance.
|
||||
*/
|
||||
public function get($url)
|
||||
{
|
||||
$params = ['url' => (string) $url];
|
||||
$this->execute(DriverCommand::GET, $params);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a string representing the current URL that the browser is looking at.
|
||||
*
|
||||
* @return string The current URL.
|
||||
*/
|
||||
public function getCurrentURL()
|
||||
{
|
||||
return $this->execute(DriverCommand::GET_CURRENT_URL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the source of the last loaded page.
|
||||
*
|
||||
* @return string The current page source.
|
||||
*/
|
||||
public function getPageSource()
|
||||
{
|
||||
return $this->execute(DriverCommand::GET_PAGE_SOURCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the title of the current page.
|
||||
*
|
||||
* @return string The title of the current page.
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->execute(DriverCommand::GET_TITLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an opaque handle to this window that uniquely identifies it within this driver instance.
|
||||
*
|
||||
* @return string The current window handle.
|
||||
*/
|
||||
public function getWindowHandle()
|
||||
{
|
||||
return $this->execute(
|
||||
DriverCommand::GET_CURRENT_WINDOW_HANDLE,
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all window handles available to the current session.
|
||||
*
|
||||
* @return array An array of string containing all available window handles.
|
||||
*/
|
||||
public function getWindowHandles()
|
||||
{
|
||||
return $this->execute(DriverCommand::GET_WINDOW_HANDLES, []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Quits this driver, closing every associated window.
|
||||
*/
|
||||
public function quit()
|
||||
{
|
||||
$this->execute(DriverCommand::QUIT);
|
||||
$this->executor = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame.
|
||||
* The executed script is assumed to be synchronous and the result of evaluating the script will be returned.
|
||||
*
|
||||
* @param string $script The script to inject.
|
||||
* @param array $arguments The arguments of the script.
|
||||
* @return mixed The return value of the script.
|
||||
*/
|
||||
public function executeScript($script, array $arguments = [])
|
||||
{
|
||||
$params = [
|
||||
'script' => $script,
|
||||
'args' => $this->prepareScriptArguments($arguments),
|
||||
];
|
||||
|
||||
return $this->execute(DriverCommand::EXECUTE_SCRIPT, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inject a snippet of JavaScript into the page for asynchronous execution in the context of the currently selected
|
||||
* frame.
|
||||
*
|
||||
* The driver will pass a callback as the last argument to the snippet, and block until the callback is invoked.
|
||||
*
|
||||
* You may need to define script timeout using `setScriptTimeout()` method of `WebDriverTimeouts` first.
|
||||
*
|
||||
* @param string $script The script to inject.
|
||||
* @param array $arguments The arguments of the script.
|
||||
* @return mixed The value passed by the script to the callback.
|
||||
*/
|
||||
public function executeAsyncScript($script, array $arguments = [])
|
||||
{
|
||||
$params = [
|
||||
'script' => $script,
|
||||
'args' => $this->prepareScriptArguments($arguments),
|
||||
];
|
||||
|
||||
return $this->execute(
|
||||
DriverCommand::EXECUTE_ASYNC_SCRIPT,
|
||||
$params
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Take a screenshot of the current page.
|
||||
*
|
||||
* @param string $save_as The path of the screenshot to be saved.
|
||||
* @return string The screenshot in PNG format.
|
||||
*/
|
||||
public function takeScreenshot($save_as = null)
|
||||
{
|
||||
$screenshot = base64_decode(
|
||||
$this->execute(DriverCommand::SCREENSHOT)
|
||||
);
|
||||
if ($save_as) {
|
||||
file_put_contents($save_as, $screenshot);
|
||||
}
|
||||
|
||||
return $screenshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new WebDriverWait by the current WebDriver instance.
|
||||
* Sample usage:
|
||||
*
|
||||
* ```
|
||||
* $driver->wait(20, 1000)->until(
|
||||
* WebDriverExpectedCondition::titleIs('WebDriver Page')
|
||||
* );
|
||||
* ```
|
||||
* @param int $timeout_in_second
|
||||
* @param int $interval_in_millisecond
|
||||
*
|
||||
* @return WebDriverWait
|
||||
*/
|
||||
public function wait($timeout_in_second = 30, $interval_in_millisecond = 250)
|
||||
{
|
||||
return new WebDriverWait(
|
||||
$this,
|
||||
$timeout_in_second,
|
||||
$interval_in_millisecond
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* An abstraction for managing stuff you would do in a browser menu. For example, adding and deleting cookies.
|
||||
*
|
||||
* @return WebDriverOptions
|
||||
*/
|
||||
public function manage()
|
||||
{
|
||||
return new WebDriverOptions($this->getExecuteMethod());
|
||||
}
|
||||
|
||||
/**
|
||||
* An abstraction allowing the driver to access the browser's history and to navigate to a given URL.
|
||||
*
|
||||
* @return WebDriverNavigation
|
||||
* @see WebDriverNavigation
|
||||
*/
|
||||
public function navigate()
|
||||
{
|
||||
return new WebDriverNavigation($this->getExecuteMethod());
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch to a different window or frame.
|
||||
*
|
||||
* @return RemoteTargetLocator
|
||||
* @see RemoteTargetLocator
|
||||
*/
|
||||
public function switchTo()
|
||||
{
|
||||
return new RemoteTargetLocator($this->getExecuteMethod(), $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RemoteMouse
|
||||
*/
|
||||
public function getMouse()
|
||||
{
|
||||
if (!$this->mouse) {
|
||||
$this->mouse = new RemoteMouse($this->getExecuteMethod());
|
||||
}
|
||||
|
||||
return $this->mouse;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RemoteKeyboard
|
||||
*/
|
||||
public function getKeyboard()
|
||||
{
|
||||
if (!$this->keyboard) {
|
||||
$this->keyboard = new RemoteKeyboard($this->getExecuteMethod());
|
||||
}
|
||||
|
||||
return $this->keyboard;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RemoteTouchScreen
|
||||
*/
|
||||
public function getTouch()
|
||||
{
|
||||
if (!$this->touch) {
|
||||
$this->touch = new RemoteTouchScreen($this->getExecuteMethod());
|
||||
}
|
||||
|
||||
return $this->touch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new action builder.
|
||||
*
|
||||
* @return WebDriverActions
|
||||
*/
|
||||
public function action()
|
||||
{
|
||||
return new WebDriverActions($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the command executor of this RemoteWebdriver
|
||||
*
|
||||
* @deprecated To be removed in the future. Executor should be passed in the constructor.
|
||||
* @internal
|
||||
* @codeCoverageIgnore
|
||||
* @param WebDriverCommandExecutor $executor Despite the typehint, it have be an instance of HttpCommandExecutor.
|
||||
* @return RemoteWebDriver
|
||||
*/
|
||||
public function setCommandExecutor(WebDriverCommandExecutor $executor)
|
||||
{
|
||||
$this->executor = $executor;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the command executor of this RemoteWebdriver
|
||||
*
|
||||
* @return HttpCommandExecutor
|
||||
*/
|
||||
public function getCommandExecutor()
|
||||
{
|
||||
return $this->executor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the session id of the RemoteWebDriver.
|
||||
*
|
||||
* @deprecated To be removed in the future. Session ID should be passed in the constructor.
|
||||
* @internal
|
||||
* @codeCoverageIgnore
|
||||
* @param string $session_id
|
||||
* @return RemoteWebDriver
|
||||
*/
|
||||
public function setSessionID($session_id)
|
||||
{
|
||||
$this->sessionID = $session_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current selenium sessionID
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSessionID()
|
||||
{
|
||||
return $this->sessionID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get capabilities of the RemoteWebDriver.
|
||||
*
|
||||
* @return WebDriverCapabilities
|
||||
*/
|
||||
public function getCapabilities()
|
||||
{
|
||||
return $this->capabilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of the currently active sessions.
|
||||
*
|
||||
* @param string $selenium_server_url The url of the remote Selenium WebDriver server
|
||||
* @param int $timeout_in_ms
|
||||
* @return array
|
||||
*/
|
||||
public static function getAllSessions($selenium_server_url = 'http://localhost:4444/wd/hub', $timeout_in_ms = 30000)
|
||||
{
|
||||
$executor = new HttpCommandExecutor($selenium_server_url);
|
||||
$executor->setConnectionTimeout($timeout_in_ms);
|
||||
|
||||
$command = new WebDriverCommand(
|
||||
null,
|
||||
DriverCommand::GET_ALL_SESSIONS,
|
||||
[]
|
||||
);
|
||||
|
||||
return $executor->execute($command)->getValue();
|
||||
}
|
||||
|
||||
public function execute($command_name, $params = [])
|
||||
{
|
||||
$command = new WebDriverCommand(
|
||||
$this->sessionID,
|
||||
$command_name,
|
||||
$params
|
||||
);
|
||||
|
||||
if ($this->executor) {
|
||||
$response = $this->executor->execute($command);
|
||||
|
||||
return $response->getValue();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare arguments for JavaScript injection
|
||||
*
|
||||
* @param array $arguments
|
||||
* @return array
|
||||
*/
|
||||
protected function prepareScriptArguments(array $arguments)
|
||||
{
|
||||
$args = [];
|
||||
foreach ($arguments as $key => $value) {
|
||||
if ($value instanceof WebDriverElement) {
|
||||
$args[$key] = ['ELEMENT' => $value->getID()];
|
||||
} else {
|
||||
if (is_array($value)) {
|
||||
$value = $this->prepareScriptArguments($value);
|
||||
}
|
||||
$args[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RemoteExecuteMethod
|
||||
*/
|
||||
protected function getExecuteMethod()
|
||||
{
|
||||
if (!$this->executeMethod) {
|
||||
$this->executeMethod = new RemoteExecuteMethod($this);
|
||||
}
|
||||
|
||||
return $this->executeMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the WebDriverElement with the given id.
|
||||
*
|
||||
* @param string $id The id of the element to be created.
|
||||
* @return RemoteWebElement
|
||||
*/
|
||||
protected function newElement($id)
|
||||
{
|
||||
return new RemoteWebElement($this->getExecuteMethod(), $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cast legacy types (array or null) to DesiredCapabilities object. To be removed in future when instance of
|
||||
* DesiredCapabilities will be required.
|
||||
*
|
||||
* @param array|DesiredCapabilities|null $desired_capabilities
|
||||
* @return DesiredCapabilities
|
||||
*/
|
||||
protected static function castToDesiredCapabilitiesObject($desired_capabilities = null)
|
||||
{
|
||||
if ($desired_capabilities === null) {
|
||||
return new DesiredCapabilities();
|
||||
}
|
||||
|
||||
if (is_array($desired_capabilities)) {
|
||||
return new DesiredCapabilities($desired_capabilities);
|
||||
}
|
||||
|
||||
return $desired_capabilities;
|
||||
}
|
||||
}
|
||||
453
vendor/facebook/webdriver/lib/Remote/RemoteWebElement.php
vendored
Normal file
453
vendor/facebook/webdriver/lib/Remote/RemoteWebElement.php
vendored
Normal file
@@ -0,0 +1,453 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Remote;
|
||||
|
||||
use Facebook\WebDriver\Exception\WebDriverException;
|
||||
use Facebook\WebDriver\Interactions\Internal\WebDriverCoordinates;
|
||||
use Facebook\WebDriver\Internal\WebDriverLocatable;
|
||||
use Facebook\WebDriver\WebDriverBy;
|
||||
use Facebook\WebDriver\WebDriverDimension;
|
||||
use Facebook\WebDriver\WebDriverElement;
|
||||
use Facebook\WebDriver\WebDriverKeys;
|
||||
use Facebook\WebDriver\WebDriverPoint;
|
||||
use ZipArchive;
|
||||
|
||||
/**
|
||||
* Represents an HTML element.
|
||||
*/
|
||||
class RemoteWebElement implements WebDriverElement, WebDriverLocatable
|
||||
{
|
||||
/**
|
||||
* @var RemoteExecuteMethod
|
||||
*/
|
||||
protected $executor;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $id;
|
||||
/**
|
||||
* @var UselessFileDetector
|
||||
*/
|
||||
protected $fileDetector;
|
||||
|
||||
/**
|
||||
* @param RemoteExecuteMethod $executor
|
||||
* @param string $id
|
||||
*/
|
||||
public function __construct(RemoteExecuteMethod $executor, $id)
|
||||
{
|
||||
$this->executor = $executor;
|
||||
$this->id = $id;
|
||||
$this->fileDetector = new UselessFileDetector();
|
||||
}
|
||||
|
||||
/**
|
||||
* If this element is a TEXTAREA or text INPUT element, this will clear the value.
|
||||
*
|
||||
* @return RemoteWebElement The current instance.
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$this->executor->execute(
|
||||
DriverCommand::CLEAR_ELEMENT,
|
||||
[':id' => $this->id]
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Click this element.
|
||||
*
|
||||
* @return RemoteWebElement The current instance.
|
||||
*/
|
||||
public function click()
|
||||
{
|
||||
$this->executor->execute(
|
||||
DriverCommand::CLICK_ELEMENT,
|
||||
[':id' => $this->id]
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the first WebDriverElement within this element using the given mechanism.
|
||||
*
|
||||
* @param WebDriverBy $by
|
||||
* @return RemoteWebElement NoSuchElementException is thrown in
|
||||
* HttpCommandExecutor if no element is found.
|
||||
* @see WebDriverBy
|
||||
*/
|
||||
public function findElement(WebDriverBy $by)
|
||||
{
|
||||
$params = [
|
||||
'using' => $by->getMechanism(),
|
||||
'value' => $by->getValue(),
|
||||
':id' => $this->id,
|
||||
];
|
||||
$raw_element = $this->executor->execute(
|
||||
DriverCommand::FIND_CHILD_ELEMENT,
|
||||
$params
|
||||
);
|
||||
|
||||
return $this->newElement($raw_element['ELEMENT']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find all WebDriverElements within this element using the given mechanism.
|
||||
*
|
||||
* @param WebDriverBy $by
|
||||
* @return RemoteWebElement[] A list of all WebDriverElements, or an empty
|
||||
* array if nothing matches
|
||||
* @see WebDriverBy
|
||||
*/
|
||||
public function findElements(WebDriverBy $by)
|
||||
{
|
||||
$params = [
|
||||
'using' => $by->getMechanism(),
|
||||
'value' => $by->getValue(),
|
||||
':id' => $this->id,
|
||||
];
|
||||
$raw_elements = $this->executor->execute(
|
||||
DriverCommand::FIND_CHILD_ELEMENTS,
|
||||
$params
|
||||
);
|
||||
|
||||
$elements = [];
|
||||
foreach ($raw_elements as $raw_element) {
|
||||
$elements[] = $this->newElement($raw_element['ELEMENT']);
|
||||
}
|
||||
|
||||
return $elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of a the given attribute of the element.
|
||||
*
|
||||
* @param string $attribute_name The name of the attribute.
|
||||
* @return string|null The value of the attribute.
|
||||
*/
|
||||
public function getAttribute($attribute_name)
|
||||
{
|
||||
$params = [
|
||||
':name' => $attribute_name,
|
||||
':id' => $this->id,
|
||||
];
|
||||
|
||||
return $this->executor->execute(
|
||||
DriverCommand::GET_ELEMENT_ATTRIBUTE,
|
||||
$params
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of a given CSS property.
|
||||
*
|
||||
* @param string $css_property_name The name of the CSS property.
|
||||
* @return string The value of the CSS property.
|
||||
*/
|
||||
public function getCSSValue($css_property_name)
|
||||
{
|
||||
$params = [
|
||||
':propertyName' => $css_property_name,
|
||||
':id' => $this->id,
|
||||
];
|
||||
|
||||
return $this->executor->execute(
|
||||
DriverCommand::GET_ELEMENT_VALUE_OF_CSS_PROPERTY,
|
||||
$params
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the location of element relative to the top-left corner of the page.
|
||||
*
|
||||
* @return WebDriverPoint The location of the element.
|
||||
*/
|
||||
public function getLocation()
|
||||
{
|
||||
$location = $this->executor->execute(
|
||||
DriverCommand::GET_ELEMENT_LOCATION,
|
||||
[':id' => $this->id]
|
||||
);
|
||||
|
||||
return new WebDriverPoint($location['x'], $location['y']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try scrolling the element into the view port and return the location of
|
||||
* element relative to the top-left corner of the page afterwards.
|
||||
*
|
||||
* @return WebDriverPoint The location of the element.
|
||||
*/
|
||||
public function getLocationOnScreenOnceScrolledIntoView()
|
||||
{
|
||||
$location = $this->executor->execute(
|
||||
DriverCommand::GET_ELEMENT_LOCATION_ONCE_SCROLLED_INTO_VIEW,
|
||||
[':id' => $this->id]
|
||||
);
|
||||
|
||||
return new WebDriverPoint($location['x'], $location['y']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WebDriverCoordinates
|
||||
*/
|
||||
public function getCoordinates()
|
||||
{
|
||||
$element = $this;
|
||||
|
||||
$on_screen = null; // planned but not yet implemented
|
||||
$in_view_port = function () use ($element) {
|
||||
return $element->getLocationOnScreenOnceScrolledIntoView();
|
||||
};
|
||||
$on_page = function () use ($element) {
|
||||
return $element->getLocation();
|
||||
};
|
||||
$auxiliary = $this->getID();
|
||||
|
||||
return new WebDriverCoordinates(
|
||||
$on_screen,
|
||||
$in_view_port,
|
||||
$on_page,
|
||||
$auxiliary
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the size of element.
|
||||
*
|
||||
* @return WebDriverDimension The dimension of the element.
|
||||
*/
|
||||
public function getSize()
|
||||
{
|
||||
$size = $this->executor->execute(
|
||||
DriverCommand::GET_ELEMENT_SIZE,
|
||||
[':id' => $this->id]
|
||||
);
|
||||
|
||||
return new WebDriverDimension($size['width'], $size['height']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the (lowercase) tag name of this element.
|
||||
*
|
||||
* @return string The tag name.
|
||||
*/
|
||||
public function getTagName()
|
||||
{
|
||||
// Force tag name to be lowercase as expected by JsonWire protocol for Opera driver
|
||||
// until this issue is not resolved :
|
||||
// https://github.com/operasoftware/operadriver/issues/102
|
||||
// Remove it when fixed to be consistent with the protocol.
|
||||
return mb_strtolower($this->executor->execute(
|
||||
DriverCommand::GET_ELEMENT_TAG_NAME,
|
||||
[':id' => $this->id]
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the visible (i.e. not hidden by CSS) innerText of this element,
|
||||
* including sub-elements, without any leading or trailing whitespace.
|
||||
*
|
||||
* @return string The visible innerText of this element.
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
return $this->executor->execute(
|
||||
DriverCommand::GET_ELEMENT_TEXT,
|
||||
[':id' => $this->id]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this element displayed or not? This method avoids the problem of having
|
||||
* to parse an element's "style" attribute.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDisplayed()
|
||||
{
|
||||
return $this->executor->execute(
|
||||
DriverCommand::IS_ELEMENT_DISPLAYED,
|
||||
[':id' => $this->id]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the element currently enabled or not? This will generally return true
|
||||
* for everything but disabled input elements.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isEnabled()
|
||||
{
|
||||
return $this->executor->execute(
|
||||
DriverCommand::IS_ELEMENT_ENABLED,
|
||||
[':id' => $this->id]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether or not this element is selected or not.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSelected()
|
||||
{
|
||||
return $this->executor->execute(
|
||||
DriverCommand::IS_ELEMENT_SELECTED,
|
||||
[':id' => $this->id]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulate typing into an element, which may set its value.
|
||||
*
|
||||
* @param mixed $value The data to be typed.
|
||||
* @return RemoteWebElement The current instance.
|
||||
*/
|
||||
public function sendKeys($value)
|
||||
{
|
||||
$local_file = $this->fileDetector->getLocalFile($value);
|
||||
if ($local_file === null) {
|
||||
$params = [
|
||||
'value' => WebDriverKeys::encode($value),
|
||||
':id' => $this->id,
|
||||
];
|
||||
$this->executor->execute(DriverCommand::SEND_KEYS_TO_ELEMENT, $params);
|
||||
} else {
|
||||
$remote_path = $this->upload($local_file);
|
||||
$params = [
|
||||
'value' => WebDriverKeys::encode($remote_path),
|
||||
':id' => $this->id,
|
||||
];
|
||||
$this->executor->execute(DriverCommand::SEND_KEYS_TO_ELEMENT, $params);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the fileDetector in order to let the RemoteWebElement to know that
|
||||
* you are going to upload a file.
|
||||
*
|
||||
* Basically, if you want WebDriver trying to send a file, set the fileDetector
|
||||
* to be LocalFileDetector. Otherwise, keep it UselessFileDetector.
|
||||
*
|
||||
* eg. `$element->setFileDetector(new LocalFileDetector);`
|
||||
*
|
||||
* @param FileDetector $detector
|
||||
* @return RemoteWebElement
|
||||
* @see FileDetector
|
||||
* @see LocalFileDetector
|
||||
* @see UselessFileDetector
|
||||
*/
|
||||
public function setFileDetector(FileDetector $detector)
|
||||
{
|
||||
$this->fileDetector = $detector;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* If this current element is a form, or an element within a form, then this will be submitted to the remote server.
|
||||
*
|
||||
* @return RemoteWebElement The current instance.
|
||||
*/
|
||||
public function submit()
|
||||
{
|
||||
$this->executor->execute(
|
||||
DriverCommand::SUBMIT_ELEMENT,
|
||||
[':id' => $this->id]
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the opaque ID of the element.
|
||||
*
|
||||
* @return string The opaque ID.
|
||||
*/
|
||||
public function getID()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if two element IDs refer to the same DOM element.
|
||||
*
|
||||
* @param WebDriverElement $other
|
||||
* @return bool
|
||||
*/
|
||||
public function equals(WebDriverElement $other)
|
||||
{
|
||||
return $this->executor->execute(DriverCommand::ELEMENT_EQUALS, [
|
||||
':id' => $this->id,
|
||||
':other' => $other->getID(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the WebDriverElement with $id
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
protected function newElement($id)
|
||||
{
|
||||
return new static($this->executor, $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload a local file to the server
|
||||
*
|
||||
* @param string $local_file
|
||||
*
|
||||
* @throws WebDriverException
|
||||
* @return string The remote path of the file.
|
||||
*/
|
||||
protected function upload($local_file)
|
||||
{
|
||||
if (!is_file($local_file)) {
|
||||
throw new WebDriverException('You may only upload files: ' . $local_file);
|
||||
}
|
||||
|
||||
// Create a temporary file in the system temp directory.
|
||||
$temp_zip = tempnam(sys_get_temp_dir(), 'WebDriverZip');
|
||||
$zip = new ZipArchive();
|
||||
if ($zip->open($temp_zip, ZipArchive::CREATE) !== true) {
|
||||
return false;
|
||||
}
|
||||
$info = pathinfo($local_file);
|
||||
$file_name = $info['basename'];
|
||||
$zip->addFile($local_file, $file_name);
|
||||
$zip->close();
|
||||
$params = [
|
||||
'file' => base64_encode(file_get_contents($temp_zip)),
|
||||
];
|
||||
$remote_path = $this->executor->execute(
|
||||
DriverCommand::UPLOAD_FILE,
|
||||
$params
|
||||
);
|
||||
unlink($temp_zip);
|
||||
|
||||
return $remote_path;
|
||||
}
|
||||
}
|
||||
68
vendor/facebook/webdriver/lib/Remote/Service/DriverCommandExecutor.php
vendored
Normal file
68
vendor/facebook/webdriver/lib/Remote/Service/DriverCommandExecutor.php
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Remote\Service;
|
||||
|
||||
use Facebook\WebDriver\Exception\WebDriverException;
|
||||
use Facebook\WebDriver\Remote\DriverCommand;
|
||||
use Facebook\WebDriver\Remote\HttpCommandExecutor;
|
||||
use Facebook\WebDriver\Remote\WebDriverCommand;
|
||||
use Facebook\WebDriver\Remote\WebDriverResponse;
|
||||
|
||||
/**
|
||||
* A HttpCommandExecutor that talks to a local driver service instead of
|
||||
* a remote server.
|
||||
*/
|
||||
class DriverCommandExecutor extends HttpCommandExecutor
|
||||
{
|
||||
/**
|
||||
* @var DriverService
|
||||
*/
|
||||
private $service;
|
||||
|
||||
public function __construct(DriverService $service)
|
||||
{
|
||||
parent::__construct($service->getURL());
|
||||
$this->service = $service;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverCommand $command
|
||||
*
|
||||
* @throws WebDriverException
|
||||
* @throws \Exception
|
||||
* @return WebDriverResponse
|
||||
*/
|
||||
public function execute(WebDriverCommand $command)
|
||||
{
|
||||
if ($command->getName() === DriverCommand::NEW_SESSION) {
|
||||
$this->service->start();
|
||||
}
|
||||
|
||||
try {
|
||||
$value = parent::execute($command);
|
||||
if ($command->getName() === DriverCommand::QUIT) {
|
||||
$this->service->stop();
|
||||
}
|
||||
|
||||
return $value;
|
||||
} catch (\Exception $e) {
|
||||
if (!$this->service->isRunning()) {
|
||||
throw new WebDriverException('The driver server has died.');
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
164
vendor/facebook/webdriver/lib/Remote/Service/DriverService.php
vendored
Normal file
164
vendor/facebook/webdriver/lib/Remote/Service/DriverService.php
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Remote\Service;
|
||||
|
||||
use Exception;
|
||||
use Facebook\WebDriver\Net\URLChecker;
|
||||
use Symfony\Component\Process\Process;
|
||||
use Symfony\Component\Process\ProcessBuilder;
|
||||
|
||||
/**
|
||||
* Start local WebDriver service (when remote WebDriver server is not used).
|
||||
*/
|
||||
class DriverService
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $executable;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $url;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $args;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $environment;
|
||||
|
||||
/**
|
||||
* @var Process|null
|
||||
*/
|
||||
private $process;
|
||||
|
||||
/**
|
||||
* @param string $executable
|
||||
* @param int $port The given port the service should use.
|
||||
* @param array $args
|
||||
* @param array|null $environment Use the system environment if it is null
|
||||
*/
|
||||
public function __construct($executable, $port, $args = [], $environment = null)
|
||||
{
|
||||
$this->executable = self::checkExecutable($executable);
|
||||
$this->url = sprintf('http://localhost:%d', $port);
|
||||
$this->args = $args;
|
||||
$this->environment = $environment ?: $_ENV;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getURL()
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DriverService
|
||||
*/
|
||||
public function start()
|
||||
{
|
||||
if ($this->process !== null) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->process = $this->createProcess();
|
||||
$this->process->start();
|
||||
|
||||
$checker = new URLChecker();
|
||||
$checker->waitUntilAvailable(20 * 1000, $this->url . '/status');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DriverService
|
||||
*/
|
||||
public function stop()
|
||||
{
|
||||
if ($this->process === null) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->process->stop();
|
||||
$this->process = null;
|
||||
|
||||
$checker = new URLChecker();
|
||||
$checker->waitUntilUnavailable(3 * 1000, $this->url . '/shutdown');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isRunning()
|
||||
{
|
||||
if ($this->process === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->process->isRunning();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the executable is executable.
|
||||
*
|
||||
* @param string $executable
|
||||
* @throws Exception
|
||||
* @return string
|
||||
*/
|
||||
protected static function checkExecutable($executable)
|
||||
{
|
||||
if (!is_file($executable)) {
|
||||
throw new Exception("'$executable' is not a file.");
|
||||
}
|
||||
|
||||
if (!is_executable($executable)) {
|
||||
throw new Exception("'$executable' is not executable.");
|
||||
}
|
||||
|
||||
return $executable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Process
|
||||
*/
|
||||
private function createProcess()
|
||||
{
|
||||
// BC: ProcessBuilder deprecated since Symfony 3.4 and removed in Symfony 4.0.
|
||||
if (class_exists(ProcessBuilder::class)
|
||||
&& false === mb_strpos('@deprecated', (new \ReflectionClass(ProcessBuilder::class))->getDocComment())
|
||||
) {
|
||||
$processBuilder = (new ProcessBuilder())
|
||||
->setPrefix($this->executable)
|
||||
->setArguments($this->args)
|
||||
->addEnvironmentVariables($this->environment);
|
||||
|
||||
return $processBuilder->getProcess();
|
||||
}
|
||||
// Safe to use since Symfony 3.3
|
||||
$commandLine = array_merge([$this->executable], $this->args);
|
||||
|
||||
return new Process($commandLine, null, $this->environment);
|
||||
}
|
||||
}
|
||||
24
vendor/facebook/webdriver/lib/Remote/UselessFileDetector.php
vendored
Normal file
24
vendor/facebook/webdriver/lib/Remote/UselessFileDetector.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Remote;
|
||||
|
||||
class UselessFileDetector implements FileDetector
|
||||
{
|
||||
public function getLocalFile($file)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
49
vendor/facebook/webdriver/lib/Remote/WebDriverBrowserType.php
vendored
Normal file
49
vendor/facebook/webdriver/lib/Remote/WebDriverBrowserType.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Remote;
|
||||
|
||||
/**
|
||||
* All the browsers supported by selenium.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class WebDriverBrowserType
|
||||
{
|
||||
const FIREFOX = 'firefox';
|
||||
const FIREFOX_PROXY = 'firefoxproxy';
|
||||
const FIREFOX_CHROME = 'firefoxchrome';
|
||||
const GOOGLECHROME = 'googlechrome';
|
||||
const SAFARI = 'safari';
|
||||
const SAFARI_PROXY = 'safariproxy';
|
||||
const OPERA = 'opera';
|
||||
const MICROSOFT_EDGE = 'MicrosoftEdge';
|
||||
const IEXPLORE = 'iexplore';
|
||||
const IEXPLORE_PROXY = 'iexploreproxy';
|
||||
const CHROME = 'chrome';
|
||||
const KONQUEROR = 'konqueror';
|
||||
const MOCK = 'mock';
|
||||
const IE_HTA = 'iehta';
|
||||
const ANDROID = 'android';
|
||||
const HTMLUNIT = 'htmlunit';
|
||||
const IE = 'internet explorer';
|
||||
const IPHONE = 'iphone';
|
||||
const IPAD = 'iPad';
|
||||
const PHANTOMJS = 'phantomjs';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
}
|
||||
45
vendor/facebook/webdriver/lib/Remote/WebDriverCapabilityType.php
vendored
Normal file
45
vendor/facebook/webdriver/lib/Remote/WebDriverCapabilityType.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Remote;
|
||||
|
||||
/**
|
||||
* WebDriverCapabilityType contains all constants defined in the WebDriver Wire Protocol.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class WebDriverCapabilityType
|
||||
{
|
||||
const BROWSER_NAME = 'browserName';
|
||||
const VERSION = 'version';
|
||||
const PLATFORM = 'platform';
|
||||
const JAVASCRIPT_ENABLED = 'javascriptEnabled';
|
||||
const TAKES_SCREENSHOT = 'takesScreenshot';
|
||||
const HANDLES_ALERTS = 'handlesAlerts';
|
||||
const DATABASE_ENABLED = 'databaseEnabled';
|
||||
const LOCATION_CONTEXT_ENABLED = 'locationContextEnabled';
|
||||
const APPLICATION_CACHE_ENABLED = 'applicationCacheEnabled';
|
||||
const BROWSER_CONNECTION_ENABLED = 'browserConnectionEnabled';
|
||||
const CSS_SELECTORS_ENABLED = 'cssSelectorsEnabled';
|
||||
const WEB_STORAGE_ENABLED = 'webStorageEnabled';
|
||||
const ROTATABLE = 'rotatable';
|
||||
const ACCEPT_SSL_CERTS = 'acceptSslCerts';
|
||||
const NATIVE_EVENTS = 'nativeEvents';
|
||||
const PROXY = 'proxy';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
}
|
||||
62
vendor/facebook/webdriver/lib/Remote/WebDriverCommand.php
vendored
Normal file
62
vendor/facebook/webdriver/lib/Remote/WebDriverCommand.php
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Remote;
|
||||
|
||||
class WebDriverCommand
|
||||
{
|
||||
/** @var string */
|
||||
private $sessionID;
|
||||
/** @var string */
|
||||
private $name;
|
||||
/** @var array */
|
||||
private $parameters;
|
||||
|
||||
/**
|
||||
* @param string $session_id
|
||||
* @param string $name Constant from DriverCommand
|
||||
* @param array $parameters Array of
|
||||
*/
|
||||
public function __construct($session_id, $name, $parameters)
|
||||
{
|
||||
$this->sessionID = $session_id;
|
||||
$this->name = $name;
|
||||
$this->parameters = $parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSessionID()
|
||||
{
|
||||
return $this->sessionID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getParameters()
|
||||
{
|
||||
return $this->parameters;
|
||||
}
|
||||
}
|
||||
97
vendor/facebook/webdriver/lib/Remote/WebDriverResponse.php
vendored
Normal file
97
vendor/facebook/webdriver/lib/Remote/WebDriverResponse.php
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Remote;
|
||||
|
||||
class WebDriverResponse
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $status;
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
private $value;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $sessionID;
|
||||
|
||||
/**
|
||||
* @param null|string $session_id
|
||||
*/
|
||||
public function __construct($session_id = null)
|
||||
{
|
||||
$this->sessionID = $session_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|int
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $status
|
||||
* @return WebDriverResponse
|
||||
*/
|
||||
public function setStatus($status)
|
||||
{
|
||||
$this->status = $status;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return WebDriverResponse
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getSessionID()
|
||||
{
|
||||
return $this->sessionID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $session_id
|
||||
* @return WebDriverResponse
|
||||
*/
|
||||
public function setSessionID($session_id)
|
||||
{
|
||||
$this->sessionID = $session_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
417
vendor/facebook/webdriver/lib/Support/Events/EventFiringWebDriver.php
vendored
Normal file
417
vendor/facebook/webdriver/lib/Support/Events/EventFiringWebDriver.php
vendored
Normal file
@@ -0,0 +1,417 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Support\Events;
|
||||
|
||||
use Facebook\WebDriver\Exception\UnsupportedOperationException;
|
||||
use Facebook\WebDriver\Exception\WebDriverException;
|
||||
use Facebook\WebDriver\Interactions\Touch\WebDriverTouchScreen;
|
||||
use Facebook\WebDriver\JavaScriptExecutor;
|
||||
use Facebook\WebDriver\WebDriver;
|
||||
use Facebook\WebDriver\WebDriverBy;
|
||||
use Facebook\WebDriver\WebDriverDispatcher;
|
||||
use Facebook\WebDriver\WebDriverElement;
|
||||
use Facebook\WebDriver\WebDriverOptions;
|
||||
use Facebook\WebDriver\WebDriverTargetLocator;
|
||||
use Facebook\WebDriver\WebDriverWait;
|
||||
|
||||
class EventFiringWebDriver implements WebDriver, JavaScriptExecutor
|
||||
{
|
||||
/**
|
||||
* @var WebDriver
|
||||
*/
|
||||
protected $driver;
|
||||
|
||||
/**
|
||||
* @var WebDriverDispatcher
|
||||
*/
|
||||
protected $dispatcher;
|
||||
|
||||
/**
|
||||
* @param WebDriver $driver
|
||||
* @param WebDriverDispatcher $dispatcher
|
||||
*/
|
||||
public function __construct(WebDriver $driver, WebDriverDispatcher $dispatcher = null)
|
||||
{
|
||||
$this->dispatcher = $dispatcher ?: new WebDriverDispatcher();
|
||||
if (!$this->dispatcher->getDefaultDriver()) {
|
||||
$this->dispatcher->setDefaultDriver($this);
|
||||
}
|
||||
$this->driver = $driver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WebDriverDispatcher
|
||||
*/
|
||||
public function getDispatcher()
|
||||
{
|
||||
return $this->dispatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WebDriver
|
||||
*/
|
||||
public function getWebDriver()
|
||||
{
|
||||
return $this->driver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $url
|
||||
* @throws WebDriverException
|
||||
* @return $this
|
||||
*/
|
||||
public function get($url)
|
||||
{
|
||||
$this->dispatch('beforeNavigateTo', $url, $this);
|
||||
try {
|
||||
$this->driver->get($url);
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
$this->dispatch('afterNavigateTo', $url, $this);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverBy $by
|
||||
* @throws WebDriverException
|
||||
* @return array
|
||||
*/
|
||||
public function findElements(WebDriverBy $by)
|
||||
{
|
||||
$this->dispatch('beforeFindBy', $by, null, $this);
|
||||
$elements = [];
|
||||
|
||||
try {
|
||||
foreach ($this->driver->findElements($by) as $element) {
|
||||
$elements[] = $this->newElement($element);
|
||||
}
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
|
||||
$this->dispatch('afterFindBy', $by, null, $this);
|
||||
|
||||
return $elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverBy $by
|
||||
* @throws WebDriverException
|
||||
* @return EventFiringWebElement
|
||||
*/
|
||||
public function findElement(WebDriverBy $by)
|
||||
{
|
||||
$this->dispatch('beforeFindBy', $by, null, $this);
|
||||
|
||||
try {
|
||||
$element = $this->newElement($this->driver->findElement($by));
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
|
||||
$this->dispatch('afterFindBy', $by, null, $this);
|
||||
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $script
|
||||
* @param array $arguments
|
||||
* @throws WebDriverException
|
||||
* @return mixed
|
||||
*/
|
||||
public function executeScript($script, array $arguments = [])
|
||||
{
|
||||
if (!$this->driver instanceof JavaScriptExecutor) {
|
||||
throw new UnsupportedOperationException(
|
||||
'driver does not implement JavaScriptExecutor'
|
||||
);
|
||||
}
|
||||
|
||||
$this->dispatch('beforeScript', $script, $this);
|
||||
|
||||
try {
|
||||
$result = $this->driver->executeScript($script, $arguments);
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
|
||||
$this->dispatch('afterScript', $script, $this);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $script
|
||||
* @param array $arguments
|
||||
* @throws WebDriverException
|
||||
* @return mixed
|
||||
*/
|
||||
public function executeAsyncScript($script, array $arguments = [])
|
||||
{
|
||||
if (!$this->driver instanceof JavaScriptExecutor) {
|
||||
throw new UnsupportedOperationException(
|
||||
'driver does not implement JavaScriptExecutor'
|
||||
);
|
||||
}
|
||||
|
||||
$this->dispatch('beforeScript', $script, $this);
|
||||
try {
|
||||
$result = $this->driver->executeAsyncScript($script, $arguments);
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
$this->dispatch('afterScript', $script, $this);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return $this
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
try {
|
||||
$this->driver->close();
|
||||
|
||||
return $this;
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrentURL()
|
||||
{
|
||||
try {
|
||||
return $this->driver->getCurrentURL();
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return string
|
||||
*/
|
||||
public function getPageSource()
|
||||
{
|
||||
try {
|
||||
return $this->driver->getPageSource();
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
try {
|
||||
return $this->driver->getTitle();
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return string
|
||||
*/
|
||||
public function getWindowHandle()
|
||||
{
|
||||
try {
|
||||
return $this->driver->getWindowHandle();
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return array
|
||||
*/
|
||||
public function getWindowHandles()
|
||||
{
|
||||
try {
|
||||
return $this->driver->getWindowHandles();
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
*/
|
||||
public function quit()
|
||||
{
|
||||
try {
|
||||
$this->driver->quit();
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|string $save_as
|
||||
* @throws WebDriverException
|
||||
* @return string
|
||||
*/
|
||||
public function takeScreenshot($save_as = null)
|
||||
{
|
||||
try {
|
||||
return $this->driver->takeScreenshot($save_as);
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $timeout_in_second
|
||||
* @param int $interval_in_millisecond
|
||||
* @throws WebDriverException
|
||||
* @return WebDriverWait
|
||||
*/
|
||||
public function wait($timeout_in_second = 30, $interval_in_millisecond = 250)
|
||||
{
|
||||
try {
|
||||
return $this->driver->wait($timeout_in_second, $interval_in_millisecond);
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return WebDriverOptions
|
||||
*/
|
||||
public function manage()
|
||||
{
|
||||
try {
|
||||
return $this->driver->manage();
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return EventFiringWebDriverNavigation
|
||||
*/
|
||||
public function navigate()
|
||||
{
|
||||
try {
|
||||
return new EventFiringWebDriverNavigation(
|
||||
$this->driver->navigate(),
|
||||
$this->getDispatcher()
|
||||
);
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return WebDriverTargetLocator
|
||||
*/
|
||||
public function switchTo()
|
||||
{
|
||||
try {
|
||||
return $this->driver->switchTo();
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return WebDriverTouchScreen
|
||||
*/
|
||||
public function getTouch()
|
||||
{
|
||||
try {
|
||||
return $this->driver->getTouch();
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
public function execute($name, $params)
|
||||
{
|
||||
try {
|
||||
return $this->driver->execute($name, $params);
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverElement $element
|
||||
* @return EventFiringWebElement
|
||||
*/
|
||||
protected function newElement(WebDriverElement $element)
|
||||
{
|
||||
return new EventFiringWebElement($element, $this->getDispatcher());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $method
|
||||
* @param mixed ...$arguments
|
||||
*/
|
||||
protected function dispatch($method, ...$arguments)
|
||||
{
|
||||
if (!$this->dispatcher) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->dispatcher->dispatch($method, $arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverException $exception
|
||||
*/
|
||||
protected function dispatchOnException(WebDriverException $exception)
|
||||
{
|
||||
$this->dispatch('onException', $exception, $this);
|
||||
}
|
||||
}
|
||||
170
vendor/facebook/webdriver/lib/Support/Events/EventFiringWebDriverNavigation.php
vendored
Normal file
170
vendor/facebook/webdriver/lib/Support/Events/EventFiringWebDriverNavigation.php
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Support\Events;
|
||||
|
||||
use Facebook\WebDriver\Exception\WebDriverException;
|
||||
use Facebook\WebDriver\WebDriverDispatcher;
|
||||
use Facebook\WebDriver\WebDriverNavigation;
|
||||
|
||||
class EventFiringWebDriverNavigation
|
||||
{
|
||||
/**
|
||||
* @var WebDriverNavigation
|
||||
*/
|
||||
protected $navigator;
|
||||
/**
|
||||
* @var WebDriverDispatcher
|
||||
*/
|
||||
protected $dispatcher;
|
||||
|
||||
/**
|
||||
* @param WebDriverNavigation $navigator
|
||||
* @param WebDriverDispatcher $dispatcher
|
||||
*/
|
||||
public function __construct(WebDriverNavigation $navigator, WebDriverDispatcher $dispatcher)
|
||||
{
|
||||
$this->navigator = $navigator;
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WebDriverDispatcher
|
||||
*/
|
||||
public function getDispatcher()
|
||||
{
|
||||
return $this->dispatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WebDriverNavigation
|
||||
*/
|
||||
public function getNavigator()
|
||||
{
|
||||
return $this->navigator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return $this
|
||||
*/
|
||||
public function back()
|
||||
{
|
||||
$this->dispatch(
|
||||
'beforeNavigateBack',
|
||||
$this->getDispatcher()->getDefaultDriver()
|
||||
);
|
||||
try {
|
||||
$this->navigator->back();
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
}
|
||||
$this->dispatch(
|
||||
'afterNavigateBack',
|
||||
$this->getDispatcher()->getDefaultDriver()
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return $this
|
||||
*/
|
||||
public function forward()
|
||||
{
|
||||
$this->dispatch(
|
||||
'beforeNavigateForward',
|
||||
$this->getDispatcher()->getDefaultDriver()
|
||||
);
|
||||
try {
|
||||
$this->navigator->forward();
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
}
|
||||
$this->dispatch(
|
||||
'afterNavigateForward',
|
||||
$this->getDispatcher()->getDefaultDriver()
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return $this
|
||||
*/
|
||||
public function refresh()
|
||||
{
|
||||
try {
|
||||
$this->navigator->refresh();
|
||||
|
||||
return $this;
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $url
|
||||
* @throws WebDriverException
|
||||
* @return $this
|
||||
*/
|
||||
public function to($url)
|
||||
{
|
||||
$this->dispatch(
|
||||
'beforeNavigateTo',
|
||||
$url,
|
||||
$this->getDispatcher()->getDefaultDriver()
|
||||
);
|
||||
|
||||
try {
|
||||
$this->navigator->to($url);
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
|
||||
$this->dispatch(
|
||||
'afterNavigateTo',
|
||||
$url,
|
||||
$this->getDispatcher()->getDefaultDriver()
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $method
|
||||
* @param mixed ...$arguments
|
||||
*/
|
||||
protected function dispatch($method, ...$arguments)
|
||||
{
|
||||
if (!$this->dispatcher) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->dispatcher->dispatch($method, $arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverException $exception
|
||||
*/
|
||||
protected function dispatchOnException(WebDriverException $exception)
|
||||
{
|
||||
$this->dispatch('onException', $exception);
|
||||
}
|
||||
}
|
||||
414
vendor/facebook/webdriver/lib/Support/Events/EventFiringWebElement.php
vendored
Normal file
414
vendor/facebook/webdriver/lib/Support/Events/EventFiringWebElement.php
vendored
Normal file
@@ -0,0 +1,414 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace Facebook\WebDriver\Support\Events;
|
||||
|
||||
use Facebook\WebDriver\Exception\WebDriverException;
|
||||
use Facebook\WebDriver\Interactions\Internal\WebDriverCoordinates;
|
||||
use Facebook\WebDriver\Internal\WebDriverLocatable;
|
||||
use Facebook\WebDriver\WebDriverBy;
|
||||
use Facebook\WebDriver\WebDriverDimension;
|
||||
use Facebook\WebDriver\WebDriverDispatcher;
|
||||
use Facebook\WebDriver\WebDriverElement;
|
||||
use Facebook\WebDriver\WebDriverPoint;
|
||||
|
||||
class EventFiringWebElement implements WebDriverElement, WebDriverLocatable
|
||||
{
|
||||
/**
|
||||
* @var WebDriverElement
|
||||
*/
|
||||
protected $element;
|
||||
/**
|
||||
* @var WebDriverDispatcher
|
||||
*/
|
||||
protected $dispatcher;
|
||||
|
||||
/**
|
||||
* @param WebDriverElement $element
|
||||
* @param WebDriverDispatcher $dispatcher
|
||||
*/
|
||||
public function __construct(WebDriverElement $element, WebDriverDispatcher $dispatcher)
|
||||
{
|
||||
$this->element = $element;
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WebDriverDispatcher
|
||||
*/
|
||||
public function getDispatcher()
|
||||
{
|
||||
return $this->dispatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WebDriverElement
|
||||
*/
|
||||
public function getElement()
|
||||
{
|
||||
return $this->element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @throws WebDriverException
|
||||
* @return $this
|
||||
*/
|
||||
public function sendKeys($value)
|
||||
{
|
||||
$this->dispatch('beforeChangeValueOf', $this);
|
||||
try {
|
||||
$this->element->sendKeys($value);
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
$this->dispatch('afterChangeValueOf', $this);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return $this
|
||||
*/
|
||||
public function click()
|
||||
{
|
||||
$this->dispatch('beforeClickOn', $this);
|
||||
try {
|
||||
$this->element->click();
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
$this->dispatch('afterClickOn', $this);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverBy $by
|
||||
* @throws WebDriverException
|
||||
* @return EventFiringWebElement
|
||||
*/
|
||||
public function findElement(WebDriverBy $by)
|
||||
{
|
||||
$this->dispatch(
|
||||
'beforeFindBy',
|
||||
$by,
|
||||
$this,
|
||||
$this->dispatcher->getDefaultDriver()
|
||||
);
|
||||
|
||||
try {
|
||||
$element = $this->newElement($this->element->findElement($by));
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
|
||||
$this->dispatch(
|
||||
'afterFindBy',
|
||||
$by,
|
||||
$this,
|
||||
$this->dispatcher->getDefaultDriver()
|
||||
);
|
||||
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverBy $by
|
||||
* @throws WebDriverException
|
||||
* @return array
|
||||
*/
|
||||
public function findElements(WebDriverBy $by)
|
||||
{
|
||||
$this->dispatch(
|
||||
'beforeFindBy',
|
||||
$by,
|
||||
$this,
|
||||
$this->dispatcher->getDefaultDriver()
|
||||
);
|
||||
try {
|
||||
$elements = [];
|
||||
foreach ($this->element->findElements($by) as $element) {
|
||||
$elements[] = $this->newElement($element);
|
||||
}
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
$this->dispatch(
|
||||
'afterFindBy',
|
||||
$by,
|
||||
$this,
|
||||
$this->dispatcher->getDefaultDriver()
|
||||
);
|
||||
|
||||
return $elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return $this
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
try {
|
||||
$this->element->clear();
|
||||
|
||||
return $this;
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $attribute_name
|
||||
* @throws WebDriverException
|
||||
* @return string
|
||||
*/
|
||||
public function getAttribute($attribute_name)
|
||||
{
|
||||
try {
|
||||
return $this->element->getAttribute($attribute_name);
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $css_property_name
|
||||
* @throws WebDriverException
|
||||
* @return string
|
||||
*/
|
||||
public function getCSSValue($css_property_name)
|
||||
{
|
||||
try {
|
||||
return $this->element->getCSSValue($css_property_name);
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return WebDriverPoint
|
||||
*/
|
||||
public function getLocation()
|
||||
{
|
||||
try {
|
||||
return $this->element->getLocation();
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return WebDriverPoint
|
||||
*/
|
||||
public function getLocationOnScreenOnceScrolledIntoView()
|
||||
{
|
||||
try {
|
||||
return $this->element->getLocationOnScreenOnceScrolledIntoView();
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WebDriverCoordinates
|
||||
*/
|
||||
public function getCoordinates()
|
||||
{
|
||||
try {
|
||||
return $this->element->getCoordinates();
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return WebDriverDimension
|
||||
*/
|
||||
public function getSize()
|
||||
{
|
||||
try {
|
||||
return $this->element->getSize();
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return string
|
||||
*/
|
||||
public function getTagName()
|
||||
{
|
||||
try {
|
||||
return $this->element->getTagName();
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
try {
|
||||
return $this->element->getText();
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return bool
|
||||
*/
|
||||
public function isDisplayed()
|
||||
{
|
||||
try {
|
||||
return $this->element->isDisplayed();
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return bool
|
||||
*/
|
||||
public function isEnabled()
|
||||
{
|
||||
try {
|
||||
return $this->element->isEnabled();
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return bool
|
||||
*/
|
||||
public function isSelected()
|
||||
{
|
||||
try {
|
||||
return $this->element->isSelected();
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return $this
|
||||
*/
|
||||
public function submit()
|
||||
{
|
||||
try {
|
||||
$this->element->submit();
|
||||
|
||||
return $this;
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebDriverException
|
||||
* @return string
|
||||
*/
|
||||
public function getID()
|
||||
{
|
||||
try {
|
||||
return $this->element->getID();
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if two element IDs refer to the same DOM element.
|
||||
*
|
||||
* @param WebDriverElement $other
|
||||
* @return bool
|
||||
*/
|
||||
public function equals(WebDriverElement $other)
|
||||
{
|
||||
try {
|
||||
return $this->element->equals($other);
|
||||
} catch (WebDriverException $exception) {
|
||||
$this->dispatchOnException($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverException $exception
|
||||
*/
|
||||
protected function dispatchOnException(WebDriverException $exception)
|
||||
{
|
||||
$this->dispatch(
|
||||
'onException',
|
||||
$exception,
|
||||
$this->dispatcher->getDefaultDriver()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $method
|
||||
* @param mixed ...$arguments
|
||||
*/
|
||||
protected function dispatch($method, ...$arguments)
|
||||
{
|
||||
if (!$this->dispatcher) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->dispatcher->dispatch($method, $arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebDriverElement $element
|
||||
* @return static
|
||||
*/
|
||||
protected function newElement(WebDriverElement $element)
|
||||
{
|
||||
return new static($element, $this->getDispatcher());
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user