Kanchan
Kanchan

Reputation: 1

How to pass\ in URL in windows authentication?

To handle windows authentication, one way to handle such scenario is by passing credentials in URL itself as shown below :

driver.get('http://domain\username:[email protected]')

my user name contains a domain ex. domain\Username. However, when i pass https://domain\username:[email protected] URL it gets converted to '/'. I am using C# selenium bindings. Please suggest a solution to get this working.

Upvotes: 0

Views: 2116

Answers (1)

Nish26
Nish26

Reputation: 987

You need to replace any special character using its ASCII value .

For \ , it's 092

Also, I believe browsers have dropped support for this syntax of passing credentials along with url and i am sure it won't work if you are using latest browser version of chrome/firefox.

You should instead allow browser to show credential alert and handle it using selenium.

 IAlert alert = webDriver.SwitchTo().Alert();          
 alert.SetAuthenticationCredentials(userId,password);
 alert.Accept();  //not sure if this line is required.

Upvotes: 1

Related Questions