WebDriver\Session::timeouts PHP Method

timeouts() public method

timeouts methods: /session/:sessionId/timeouts (POST) - $session->timeouts($json) - set timeout for an operation - $session->timeouts()->method() - chaining
public timeouts ( ) : Session | WebDriver\Timeouts
return Session | WebDriver\Timeouts
    public function timeouts()
    {
        // set timeouts
        if (func_num_args() === 1) {
            $arg = func_get_arg(0);
            // json
            $this->curl('POST', '/timeouts', $arg);
            return $this;
        }
        if (func_num_args() === 2) {
            $arg = array('type' => func_get_arg(0), 'ms' => func_get_arg(1));
            $this->curl('POST', '/timeouts', $arg);
            return $this;
        }
        // chaining
        return new Timeouts($this->url . '/timeouts');
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Continuously poll the page, until you find an element
  * with the given name or id.
  *
  * @param  string  $element
  * @param  integer $timeout
  * @return static
  */
 public function waitForElement($element, $timeout = 5000)
 {
     $this->session->timeouts()->postImplicit_wait(['ms' => $timeout]);
     try {
         $this->findByNameOrId($element);
     } catch (InvalidArgumentException $e) {
         throw new InvalidArgumentException("Hey, what's happening... Look, I waited {$timeout} milliseconds to see an element with " . "a name or id of '{$element}', but no luck. \nIf you could take a look, that'd be greaaattt...");
     }
     return $this;
 }
All Usage Examples Of WebDriver\Session::timeouts