-1

I am trying to run the tests using Zalenium but the browser is asking for the credentials, so I am providing the username and password manually.

Does anyone know how to handle browser authentication?

My project uses Specflow, C# and Selenium

David
  • 2,602
  • 1
  • 18
  • 32

2 Answers2

0

There are several options

  1. You can login with http://username:password@website.com/page
  2. Automate login process at @BeforeMethod or @BeforeClass
  3. Set cookies. Although I don't advise this method since it doesn't speed up automation much and there is quite a bit of work to do to implement it.
0

You could put your web application behind a proxy that automatically injects the basic auth credentials. I did this once for a client a few years back.

I'm pretty sure I used: https://github.com/adamfisk/LittleProxy with https://github.com/ganskef/LittleProxy-mitm

But I had to write some code intercept requests and inject basic auth headers. Although from memory it was pretty straight forward.

If you don't need https then you could probably use cntlm and then set the basic auth header by hand using this:

        -r  "HeaderName: value"
        Add a header substitution. All such headers will be added/replaced
        in the client's requests.
Joel Pearson
  • 1,622
  • 1
  • 16
  • 28