public function login( $user, $password )
	{
		$this->getSession()->visit( $this->locatePath( '/wp-login.php' ) );
		$this->wait_the_element( "#loginform" );

		$element = $this->getSession()->getPage();
		$element->fillField( "user_login", $user );
		$element->fillField( "user_pass", $password );

		$submit = $element->findButton( "wp-submit" );
		$submit->click();

		for ( $i = 0; $i < $this->timeout; $i++ ) {
			// Check if keeping staying on login page till timeout.
			try {
				if ( $this->is_current_url( '/wp-login.php' ) ) {
					// Still in login page.
					if ( $this->getSession()->getPage()->find( 'css','#login_error' ) ) {
						// Find error dialog. Apparent Error.
						return false;
					} else {
						// @todo Should consider other situations?
					}
				} else {
					// Redirected. Guess logged in.
					return true;
				}
			} catch ( \Exception $e ) {
				// do nothing
			}

			sleep( 1 );
		}

		throw new \Exception( 'Login timeout' );
	}
public function login( $user, $password )
	{
		$this->getSession()->visit( $this->locatePath( '/wp-login.php' ) );
		$this->wait_the_element( "#loginform" );

		$element = $this->getSession()->getPage();
		$element->fillField( "user_login", $user );
		$element->fillField( "user_pass", $password );

		$submit = $element->findButton( "wp-submit" );
		$submit->click();

		for ( $i = 0; $i < $this->timeout; $i++ ) {
			// Check if keeping staying on login page till timeout.
			try {
				if ( $this->is_current_url( '/wp-login.php' ) ) {
					// Still in login page.
					if ( $this->getSession()->getPage()->find( 'css','#login_error' ) ) {
						// Find error dialog. Apparent Error.
						return false;
					} else {
						// @todo Should consider other situations?
					}
				} else {
					// Redirected. Guess logged in.
					return true;
				}
			} catch ( \Exception $e ) {
				// do nothing
			}

			sleep( 1 );
		}

		throw new \Exception( 'Login timeout' );
	}
public function login ( $ user , $ password ) { $ this -> getSession ( ) -> visit ( $ this -> locatePath ( '/wp-login.php' ) ) ; $ this -> wait_the_element ( "#loginform" ) ; $ element = $ this -> getSession ( ) -> getPage ( ) ; $ element -> fillField ( "user_login" , $ user ) ; $ element -> fillField ( "user_pass" , $ password ) ; $ submit = $ element -> findButton ( "wp-submit" ) ; $ submit -> click ( ) ; for ( $ i = 0 ; $ i < $ this -> timeout ; $ i ++ ) { // Check if keeping staying on login page till timeout. try { if ( $ this -> is_current_url ( '/wp-login.php' ) ) { // Still in login page. if ( $ this -> getSession ( ) -> getPage ( ) -> find ( 'css' , '#login_error' ) ) { // Find error dialog. Apparent Error. return false ; } else { // @todo Should consider other situations? } } else { // Redirected. Guess logged in. return true ; } } catch ( \ Exception $ e ) { // do nothing } sleep ( 1 ) ; } throw new \ Exception ( 'Login timeout' ) ; }
Log in into the WordPress.

@param string $user The user name.
@param string $password The password.
@return bool
@throws \Exception If the page returns something wrong.
Log in into the WordPress .