Conditions | 4 |
Paths | 24 |
Total Lines | 30 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
34 | public function execute($remember = false) |
||
35 | { |
||
36 | $url = $this->webDriver->getCurrentURL(); |
||
37 | if ($url !== $this->theme->getTwitterUrl()) { |
||
38 | $this->open->open($this->theme->getTwitterUrl()); |
||
39 | } |
||
40 | |||
41 | try { |
||
42 | $element = $this->webDriver->byXpath($this->theme->getLoginButtonXpath()); |
||
43 | $element->click(); |
||
44 | |||
45 | $element = $this->webDriver->byXpath($this->theme->getSiteUsernameXpath()); |
||
46 | $element->clear(); |
||
47 | $element->sendKeys($this->identity->getUsername()); |
||
48 | |||
49 | $element = $this->webDriver->byXpath($this->theme->getSitePasswordXpath()); |
||
50 | $element->clear(); |
||
51 | $element->sendKeys($this->identity->getPassword()); |
||
52 | |||
53 | if ($remember) { |
||
54 | $element = $this->webDriver->byXpath($this->theme->getRememberXpath()); |
||
55 | $element->click(); |
||
56 | } |
||
57 | |||
58 | } catch (NoSuchElementException $e) { |
||
59 | // Presuming that we're logged in |
||
60 | } |
||
61 | $element = $this->webDriver->byXpath($this->theme->getSiteSignInXpath()); |
||
62 | $element->click(); |
||
63 | } |
||
64 | |||
65 | } |