Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. /**
  2. * @return bool|Cookie|null
  3. * @throws Exception
  4. */
  5. protected function auth()
  6. {
  7. $this->driver->get(self::LOGIN_URL);
  8.  
  9. $token_key = CaptchaService::solve_captcha('key_captcha', $this->driver);
  10.  
  11. $this->driver->executeScript('document.getElementById(\'capcode\').value = "' . $token_key . '";');
  12.  
  13. $this->driver->findElement(WebDriverBy::name('email'))->sendKeys($this->account->email);
  14. $this->driver->findElement(WebDriverBy::name('psw'))->sendKeys($this->account->password);
  15.  
  16. $this->driver->findElement(WebDriverBy::className('enter'))->click();
  17.  
  18. sleep(3);
  19.  
  20. $PHPSESSID = $this->driver->manage()->getCookieNamed('PHPSESSID');
  21.  
  22. $this->driver->manage()->addCookie($PHPSESSID);
  23.  
  24. $this->account->phpsessid = $PHPSESSID->getValue();
  25. $this->account->save();
  26.  
  27. return $PHPSESSID;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement