0

I've seen this question has been asked a few times, and lots of solutions get suggested - but none of them seem to work for the RemoteWebDriver (ie: using Selenium Grid). They're usually centered around using the local ChromeDriver/FirefoxDriver/IEDriver classes.

I am using the .NET bindings, by the way :).

What I want to do is fairly simple (in terms of requirement). I have a Selenium Server setup, and am currently using the RemoteWebDriver to perform automated UI tests on various sites. This setup is working fine.

However, some sites use NTLM/Windows Authentication, and we need to start writing automated tests for these. However, as far as I can tell, there is no solution for this.

I have seen the following "solutions", but - unless someone can correct me - they either don't work consistently, or will not work using RemoteWebDriver:

  • Using the IAlert functionality (like here). However, this isn't implemented in the .NET bindings, and doesn't work for all browsers as far as I can tell.
    • Using the Robot API to interact with the popup (like here). But this is for running on your local machine, and not supported by RemoteWebDriver.
    • Using AutoIt to do a similar thing to the Robot API. However, this won't work using RemoteWebDriver.
    • Passing the credentials in the URL (eg: http://username:password@example.com). However, this doesn't work for Windows Authentication - just normal HTTP Basic Authentication.

I can't actually see any other solutions, unless anyone else can help?

A workaround currently is to log onto the Selenium server, go to the sites in each browser, and save the credentials. But this isn't ideal, and adds a level of manual interaction to each test.

Any help would be appreciated :).

Community
  • 1
  • 1
stevehayter
  • 796
  • 1
  • 7
  • 23
  • Your solution of a proxy is a good one. I'll simply point out that the authentication methods on the `IAlert` interface most certainly _have_ been implemented in the .NET bindings. The method is named `SetAuthenticationCredentials`. However, you're absolutely right that it's not implemented in all browsers (only IE, ate the time of this writing). – JimEvans Aug 15 '16 at 16:03
  • Thanks @JimEvans - I stand corrected about the IAlert being implemented in the .NET bindings :). There are so many older blog posts when it wasn't that it can be quite confusing! Thanks for clarifying though. – stevehayter Aug 16 '16 at 08:02

1 Answers1

0

It appears I have found my own solution - use a proxy which adds the NTLM negotiation/authorisation automatically. Pretty simple to setup :).

http://cntlm.sourceforge.net/

stevehayter
  • 796
  • 1
  • 7
  • 23