_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()); } /** * Checks whether the login is successful * * @return boolean */ public function isSuccessLogin() { if ($this->_selenium->isElementPresent("//*[@id=\"serverinfo\"]")) { return true; } else { return false; } } /** * Checks whether the login is unsuccessful * * @return boolean */ public function isUnsuccessLogin() { if ($this->_selenium->isElementPresent("css=div.error")) { return true; } else { return false; } } } ?>