public function setUserPassword(string $password)
    {

        // Get the session.
        $session = $this->verifySession();

        // Verify we are on the login page.
        $this->verifyLoginPage();

        // Get the page.
        $page = $session->getPage();

        // Find the user_pass field.
        $user_pass_field = $page->find('css', '#user_pass');

        // Try to focus the user_pass field.
        try {
            $user_pass_field->focus();
        } catch (UnsupportedDriverActionException $e) {
            // This will fail for GoutteDriver but neither is it necessary.
        }

        // Set the value of $password in the user_pass field.
        $user_pass_field->setValue($password);
        // The field can be stubborn, so we use fillField also.
        $page->fillField('user_pass', $password);

        // Attempt to fill the user_pass field with JavaScript.
        try {
            $session->executeScript(
                "document.getElementById('user_pass').value='$password'"
            );
        } catch (UnsupportedDriverActionException $e) {
            // This will fail for drivers without JavaScript support
        }

        // Get the actual value of the user_pass field.
        $password_actual = $user_pass_field->getValue();

        // Verify the password was filled in correctly.
        if ($password_actual !== $password) {
            throw new ExpectationException(
                sprintf(
                    'Expected the password field to be "%1$s", found "%2$s".',
                    $password,
                    $$password_actual
                ),
                $this->getDriver()
            );
        }
    }