public function login() { $this->driver->get('https://web.skype.com'); $this->driver->wait()->until(function () { return WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::id('username')); }); $this->driver->findElement(WebDriverBy::id('username'))->sendKeys($this->username); $this->driver->findElement(WebDriverBy::id('password'))->sendKeys($this->password); $this->driver->findElement(WebDriverBy::cssSelector('form'))->submit(); $this->waitForSelector('[name=query]'); sleep(15); return true; }
/** * @param \Closure|WebDriverExpectedCondition $functionOrCondition * @param int|null $timeout */ protected function _waitUntil($functionOrCondition, $timeout = null) { if (null === $timeout) { $timeout = $this->_options->getWaitTimeout(); } $this->_webDriver->wait($timeout)->until($functionOrCondition); }
/** * @param int $timeout_in_second * @param int $interval_in_millisecond * @return WebDriverWait * @throws WebDriverException */ 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); } }