public function setUserName(string $username)
    {

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

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

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

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

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

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

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

        // Get the actual value of the user_login field.
        $username_actual = $user_login_field->getValue();

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