Tried different methods for windows Authentication using Selenium Webdriver with C#

I’m using Visual Studio 2015, Selenium WebDriver – v3.14, Chromedriver – v2.43, IEdriver – v3.14. Chrome Browser – v69

I’m new in using this tool with C#, Is anyone there to help me out?

I tried to implement the same as in the online Videos but couldn’t get the desired functionality.

In my current feature, my test scenario is as such:

Step 1: once i run my test, it should launch the chrome browser and open the desired URL. in my web page, it clicks  the required Link in the website.

Step 2: After you click the link,  it triggers an  windows authentication dialog where it prompts for user credentials to authentication.

My question here is: how can i auto populate my credentials and submit the page so i can get authenticated!!!

Method1:

driver.SwitchTo().Alert().SetAuthenticationCredentials(“username”, “Password”);
alert.SendKeys(“username” + Keys.Tab + “password” + Keys.Tab);
alert.Accept();

Method2:

//Process pr = new Process();
//string val = @”username”;
//pr.StartInfo.FileName = “AutoIt3.exe”;
//pr.StartInfo.Arguments= @”/AutoIt3ExecuteScript HandleAuthentication_Chrome.au3 ” + val;
//pr.Start();

Method3:

AutoItX.WinActivate(“”, “https://www.siteurl”);
AutoItX.Send(@”username{TAB}password{ENTER}”);

 

I used all the above methods but it stops at the authentication window.

Please give your input.

Thanks in advance!!!

Default Asked on October 18, 2018 in Selenium WebDriver.
Add Comment
  • 0 Answer(s)
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.