How to Handle Authentication/Login Popup Window in writing scripts for Homepage

Can you please help me on how to handle the Login Popup Window in xceptance Framework for writing scripts for launching the Homepage shop site, please refer to the below Image?

   /**
     * Set the Basic Authentication header with given credentials.
     * {@link #setBasicAuthenticationHeader()} is to be preferred over this
     * method if possible.
     *
     * @param username
     *            must not be blank, otherwise method will act like a noop.
     * @param password
     */
    public static void setBasicAuthenticationHeader(final String username, final String password)
    {
        // Is a user name for Basic Authentication configured?
        if (StringUtils.isNotBlank(username))
        {
            // Set the request header.
            final String userPass = username + ":" + password;
            final String userPassBase64 = Base64.encodeBase64String(userPass.getBytes());

            getCurrentAction().getWebClient().addRequestHeader("Authorization", "Basic " + userPassBase64);
        }
    }

This is one way of doing that. If you forked from this test suite https://github.com/Xceptance/posters-advanced-loadtest-suite/, you have that already built in (Context.java). The method getCurrentAction() comes from that framework too. If you run a plain version of XLT, you likely need to get yourself the WebClient via https://lab.xceptance.de/releases/xlt/latest/apidoc/com/xceptance/xlt/api/actions/AbstractHtmlPageAction.html and its superclass.

As iam using plain version of XLT. How to find getCurrentAction() method, as i only able to fetch getPreviousAction() method. Unable to fetch the getCurrentAction() method in superclass.

Coming to the advanced-loadtest-suit. As I have tried importing into my IDE https://github.com/Xceptance/posters-advanced-loadtest-suite/ this advanced-loadtest-suit, but getting the error as “No Project found to Import”,

Get the web client from your current action using likely this.getWebClient(). Don’t know your code, hence I am not sure how you designed it.

Please go to the project page and fetch the correct GIT link and clone it to you disk before importing.

Thanks, @rschwietzke for your support, refer to the attachment, which made me Handle the Login Popup Window.

1 Like