0
  1. I am using C# , Selenium , AutoIt and Google Chrome.
  2. I can launch the browser, and can see the authentication pop up.
  3. Pop up window disappears when below code is executed and after that the browser stays there forever.

    autoItX3 autoIt = new AutoItX3();
    Driver.Instance.Manage().Window.Maximize();
    Driver.Instance.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(2);
    
    try
    {
        Driver.Instance.Navigate().GoToUrl(Driver.BaseAddress);
    }
    catch
    {
        return;
    }
    autoIt.WinWait("Authentication Required");
    autoIt.WinActivate("Authentication Required");
    autoIt.Send("admin");
    autoIt.Send("{TAB}");
    autoIt.Send("pass");
    autoIt.Send("{ENTER}");
    Driver.Instance.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(-1);
    
user4157124
  • 2,809
  • 13
  • 27
  • 42
Mike ASP
  • 2,013
  • 2
  • 17
  • 24
  • You can try with sikuli. Image based automation tool. – Ankur Singh Nov 21 '17 at 06:27
  • I already implemented this for Firefox and it’s working good. I am trying to find AutoIt solution if you please give me more ideas, have you tried recently to give credentials to url directly n skip the login?? – Mike ASP Nov 21 '17 at 06:29
  • You can refer this https://stackoverflow.com/questions/45105254/site-authentication-webdriver-codeception/45129087#45129087 – Ankur Singh Nov 21 '17 at 06:32
  • I tried passing driver.get("http://username:password@www.example.com/") and its not helping me out. All I can see is pop does not appear probably handled partly and I can see URL on webpage and page stays there forever. – Mike ASP Nov 21 '17 at 18:34
  • one more difference is my site is using HTTPS not HTTP. Now Google says : Some modern browsers no longer support URL encoding of basic access credentials – Mike ASP Nov 21 '17 at 19:09

2 Answers2

1

You are trying to automate a child window. Autoit doesn't see child windows untill told to.

Opt("WinSearchChildren", 1) ;0=no, 1=search children also

Allows the window search routines to search child windows as well as top-level windows. 0 = (default) Only search top-level windows 1 = Search top-level and child windows

Milos
  • 2,927
  • 1
  • 15
  • 27
  • When I write this "autoIt.WinActivate("Authentication Required");" , it means focus goes to this pop up (this is what I understand from google). Anyways I tried your solution and it's not working. I guess only solution look like is to embed credentials into the URL and bypass this login. Driver is losing the control right after URL goes to page thats where POP up comes in and Driver goes away from control. – Mike ASP Nov 21 '17 at 18:32
  • Driver.Instance.Navigate().GoToUrl(Driver.BaseAddress); autoIt.Opt("WinSearchChildren", 1); autoIt.WinWait("Authentication Required"); autoIt.WinActivate("Authentication Required"); autoIt.Send("admin"); autoIt.Send("{TAB}"); autoIt.Send("demo"); autoIt.Send("{ENTER}"); – Mike ASP Nov 21 '17 at 18:35
  • @MikeASP You should use "Autoit Window Info" in order to get the correct title/data. Also play with Opt("WinTitleMatchMode", ?) – Milos Nov 22 '17 at 10:16
  • Yes , I tried your solution already , did not work for me, thanks – Mike ASP Nov 22 '17 at 18:29
0
  1. hard to make comment without knowing the internals of the authentication implementation on the server. One thing is sure - it is a bad idea from security view because parameters appended to the URL are not secure.

    like : http://myURL.com/index.jsp/j_security_check?j_username=username&j_password=password

    or "http://username:password@www.example.com/")

  2. this is what worked for me according to our internal authentication :

    https://myURL.com/login/Login.aspx?usestandardlogin=1

    so its => "http:YouURL.com" + "?" + "usestandardlogin=1"

now I am not seeing any pop up , it just re-direct me on login.

sorak
  • 2,607
  • 2
  • 16
  • 24
Mike ASP
  • 2,013
  • 2
  • 17
  • 24