_txtUsername = 'input_username'; $this->_txtPassword = 'input_password'; $this->_btnLogin = 'input_go'; $this->_config = new TestConfig(); $this->_selenium = $selenium; } /** * perform a login * * @param string $username Username * @param string $password Password * * @return void */ public function login($username, $password) { $this->_selenium->open($this->_config->getLoginURL()); $this->_selenium->type($this->_txtUsername, $username); $this->_selenium->type($this->_txtPassword, $password); $this->_selenium->click($this->_btnLogin); $this->_selenium->waitForPageToLoad($this->_config->getTimeoutValue()); } /** * * @return boolean */ public function isSuccessLogin() { if ($this->_selenium->isElementPresent("//*[@id=\"serverinfo\"]")) { return true; } else { return false; } } /** * * @return boolean */ public function isUnsuccessLogin() { $val = $this->_selenium->getValue('input_go'); if ($this->_selenium->isElementPresent("//html/body/div/div[@class='error']")) { return true; } else { return false; } } } ?>