3

While recording test cases through the browser, the Windows Integrated Authentication window pops up, which needs a username and password for authentication. This is not being recorded by the PlayWright Headless test recorder obviously as this is not browser activity. So to automate the login process, how to handle this popup and authenticate the user, is there any workaround for this.

Could you please let me know if you have encountered this kind of issue earlier for the PlayWright test framework or any other testing framework? Any help on this and highly appreciated.

1
  • Disclaimer: I still try to figure out two factor authentication. I wonder if your app provides any other means to authenticate. The docs on Authentication mention If your web application supports signing in via API, you can use APIRequestContext to simplify sign in flow Commented May 20, 2022 at 20:08

1 Answer 1

1

I faced the same issue, unless the login window even didn't show up at first.

To prevent usage of the current user and start showing the login popup: How to disable Integrated Windows Authentication (IWA) for Chrome via Windows' Control Panel:

(This applies to both Internet Explorer and Chrome since Chrome uses system settings that are managed using Internet Explorer.)

  1. Press Windows' Start button, type "Internet Options" to search, and click the one result, from the control panel

  2. Go to the "Security" tab

  3. Select "Local Intranet" and click on "Custom Level" button

  4. Scroll to the "User Authentication" section at the bottom of the list and select "Prompt for user name and password"

  5. Click Ok, Apply, and Ok to save changes.

  6. Close all instances of the IE browser to make the changes effective. Launch the browser again and access the application. A basic authentication challenge will be served.

To login as desired user: HTTP Authentication

using var context = await Browser.NewContextAsync(new()
{
    HttpCredentials = new HttpCredentials
    {
        Username = "bill",
        Password = "pa55w0rd"
    },
});
var page = await context.NewPageAsync();
await page.GotoAsync("https://example.com");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.