Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. /**
  2. * @return bool|Cookie|null
  3. * @throws Exception
  4. */
  5. protected function auth()
  6. {
  7. $this->driver->get(self::AUTH_URL);
  8.  
  9. $captcha_text = CaptchaService::solve_captcha('normal', $this->driver);
  10.  
  11. $this->driver->findElement(WebDriverBy::id('loginform-email'))->sendKeys($this->account->email);
  12. $this->driver->findElement(WebDriverBy::id('loginform-password'))->sendKeys($this->account->password);
  13. $this->driver->findElement(WebDriverBy::id('loginform-verifycode'))->sendKeys($captcha_text);
  14.  
  15. $this->driver->executeScript("document.getElementsByClassName('btn btn_default btn_action')[0].click()");
  16.  
  17. sleep(3);
  18.  
  19. $this->driver->wait()->until(WebDriverExpectedCondition::titleIs('Sent Msg - Статистика - Subscribe for future'));
  20.  
  21. $PHPSESSID = $this->driver->manage()->getCookieNamed('PHPSESSID');
  22.  
  23. $this->driver->manage()->addCookie($PHPSESSID);
  24.  
  25. $this->account->phpsessid = $PHPSESSID->getValue();
  26. $this->account->save();
  27.  
  28. return $PHPSESSID;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement