Jump to content

AutoITX can't find the Chrome "Select a Cert" popup


Recommended Posts

Relevant Environment Details:

Chrome Version 80.0.3987.149

AutoITX.Dotnet Version: 3.3.14.5

OS: Windows 10

 

So my project is moving to Chrome support in the future. This leaves me with the task of updating our automated testing suites to suit the change. I ran into a problem regarding Chrome and the difference's between its Certificate Selection window and the one that appears in IE. I need to find out how I can obtain the attributes of Chrome's window so I can use AutoIT to interact with them. There are a few caveats though:

  1. I do not wish to select a cert. This is an internal system, but for some reason unknown to myself, our development and test environments make use of the CAC Card functionality. To access the devdefault environment they built a backdoor to bypass it by selecting Cancel on the Cert Dialogue. I do not want to select a certificate of any kind

  2.   I must use the latest version of Chrome

This is the Chrome Security Dialogue I am trying to bypass:

selectacert.png.e3f2b0825996c20856900cb286695bf6.png

 

Here is the Code I use for IE for an example of what I am trying to accomplish here:

  public void LoginMethod(string id)
    {
        DebuggingHelpers.Log.Info("Logging In.");
        if (UIValidations.IsElementPresent(By.Id("CACPress")))
        {
            UIActions.GetElement(CACTermsButton).SendKeys(Keys.Enter);
            DebuggingHelpers.Log.Info("Calling CancelSecurity DiaLogue");
            CancelSecurityDiaLogue();
            Thread.Sleep(50);
            ObjectRepository.Driver.SwitchTo().DefaultContent();

            UIActions.TypeInTextBox(CacTextBox, edipin);
            UIActions.ClickElement(CACEdipinLoginButton);
        }
        else
        {
            UIActions.GetElement(EdiTextbox).SendKeys(edipin);
            UIActions.GetElement(EdipinLoginButton).Click();
        }
        DebuggingHelpers.Log.Info("Logged in");
    }


    /// <summary>
    /// Uses AutoITX to cancel Windows Security Login Window that appears with CAC Logins
    /// </summary>
    private static void CancelSecurityDiaLogue()
    {
        //AutoItX.Send("{ESC}");

        DebuggingHelpers.Log.Info("If Exists: " + AutoItX.WinExists("Windows Security"));
        AutoItX.WinWait("Windows Security");
        if (AutoItX.WinExists("Select a certificate") == 1)
        {
            AutoItX.WinActivate("Windows Security");
            AutoItX.WinWaitActive("Windows Security");
            AutoItX.Send("{TAB}");
            AutoItX.Send("{TAB}");
            AutoItX.Send("{TAB}");
            AutoItX.Send("{ENTER}");
        }
        DebuggingHelpers.Log.Info("After If Exists in CancelSecurityDiaLogue");
    }

Found something here last night that gives me a clue: https://github.com/SeleniumHQ/selenium/issues/5408

Someone points out that Selenium hasn't finished the Navigate().GoToUrl(...) action yet, which is true because it's stuck in limbo at the auth tier and never gets to the CancelSecurityDialogue(). That is why no code after the action that makes the cert box appear executes. That checks out because that loading icon on the browser tab runs in perpetuity until you close the tab. It doesn't solve my problem, but it's a possible clue? I am just not sure what to do with the said clue. Like, in IE you have the same scenario with the same loading tab, yet you can interact with the Security Cert Popup with AutoIT, why it doesn't work that way in Chrome is what's confusing to me.

Also from what I can gather, the IE Security window must also be named differently than the Chrome window. However, when I try to find the name through AutoIT's finder tool nothing shows up. It only sees the entire Chrome window, not the security pop up. This is weird because when I use the tool in IE it can see the security window. Which correct me if I am wrong means that the Chrome window isn't the same type as the IE window, but both deal with certificates. I am really lost here.

 

Edited by friendbot2000
accidently left info on it I shouldnt
Link to post
Share on other sites
  • 5 months later...

Has anyone determined a solution for this?  I am using Selenium C# and Chrome just keeps loading and AutoITX cannot recognize the Select a Certificate window.  I tried  AutoItX.Send("{ENTER}"); and AutoItX.Send("{ESCAPE}");

Also tried SendKeys(Keys.Enter) and SendKeys(Keys.Escape).  Nothing works.  I do not have the option to change the registry either.

Link to post
Share on other sites

Has anyone determined a solution for this?  I am using Selenium C# and Chrome just keeps loading and AutoITX cannot recognize the Select a Certificate window.  I tried a Sendkey({ESC})

So I have been able to figure this out for Chrome;

added this 

chromeOptions.PageLoadStrategy = PageLoadStrategy.None;    

Then in my code I added a try/finally block.  In my try was the Click that caused the Select a Certificate to pop.  It sits for a bit and then it goes to the finally block and continues on with the Select a Certificate logic.  If you have any questions just hit me up.  I will try to help you out.

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...