class Timeouts
WebDriver\Timeouts class
@package WebDriver
@method void async_script($json) Set the amount of time, in milliseconds, that asynchronous scripts (executed by execute_async) are permitted to run before they are aborted and a timeout error is returned to the client. @method void implicit_wait($json) Set the amount of time the driver should wait when searching for elements.
Hierarchy
- class \WebDriver\AbstractWebDriver
- class \WebDriver\Timeouts extends \WebDriver\AbstractWebDriver
Expanded class hierarchy of Timeouts
1 string reference to 'Timeouts'
- WebDriver::session in vendor/
lullabot/ php-webdriver/ lib/ WebDriver/ WebDriver.php - New Session: /session (POST) Get session object for chaining
File
-
vendor/
lullabot/ php-webdriver/ lib/ WebDriver/ Timeouts.php, line 24
Namespace
WebDriverView source
class Timeouts extends AbstractWebDriver {
/**
* {@inheritdoc}
*/
protected function methods() {
return array(
// Legacy JSON Wire Protocol
'async_script' => array(
'POST',
),
'implicit_wait' => array(
'POST',
),
);
}
/**
* helper method to wait until user-defined condition is met
*
* @param callable $callback callback which returns non-false result if wait condition was met
* @param integer $maxIterations maximum number of iterations
* @param integer $sleep sleep duration in seconds between iterations
* @param array $args optional args; if the callback needs $this, then pass it here
*
* @return mixed result from callback function
*
* @throws \Exception if thrown by callback, or \WebDriver\Exception\Timeout if helper times out
*/
public function wait($callback, $maxIterations = 1, $sleep = 0, $args = array()) {
$i = max(1, $maxIterations);
while ($i-- > 0) {
$result = call_user_func_array($callback, $args);
if ($result !== false) {
return $result;
}
// don't sleep on the last iteration
$i && sleep($sleep);
}
throw WebDriverException::factory(WebDriverException::TIMEOUT, 'wait() method timed out');
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
AbstractWebDriver::$curlService | private | property | Curl service | ||
AbstractWebDriver::$transientOptions | private | property | Transient options | ||
AbstractWebDriver::$url | protected | property | URL | ||
AbstractWebDriver::assertSerializable | private | function | Sanity check | ||
AbstractWebDriver::curl | protected | function | Curl request to webdriver server. | ||
AbstractWebDriver::getCurlService | public | function | Get curl service | ||
AbstractWebDriver::getRequestMethod | private | function | Get default HTTP request method for a given WebDriver command | ||
AbstractWebDriver::getTransientOptions | public | function | |||
AbstractWebDriver::getURL | public | function | Returns URL to Selenium server | ||
AbstractWebDriver::obsoleteMethods | protected | function | Return array of obsolete method names and corresponding HTTP request methods | 4 | |
AbstractWebDriver::offsetGet | private | function | Extract value from result | ||
AbstractWebDriver::setCurlService | public | function | Set curl service | ||
AbstractWebDriver::setTransientOptions | public | function | Set transient options | ||
AbstractWebDriver::__call | public | function | Magic method that maps calls to class methods to execute WebDriver commands | 1 | |
AbstractWebDriver::__construct | public | function | Constructor | 3 | |
AbstractWebDriver::__toString | public | function | Magic method which returns URL to Selenium server | ||
Timeouts::methods | protected | function | Return array of supported method names and corresponding HTTP request methods | Overrides AbstractWebDriver::methods | |
Timeouts::wait | public | function | helper method to wait until user-defined condition is met |