Forum Discussion

svarog99's avatar
svarog99
New Contributor
10 years ago

"Windows Security" dialog not recognized during playback

I am a new user and I apologize if this has come up before.



I am attempting to record Jscript as I log into a website (the name of the website is changed for this example).



1. In IE 8, navigate to www.test.com.

2. "Windows Security" pop-up appears and I enter my credentials.

3. I am logged into the website.

4. I close the browser window.



All of these steps are recorded, including my username and password. The Windows Security dialog is recognized during the recording. But when I play it back, the Windows Security dialog is never recognized. It hangs on "Navigating to www.test.com".



I found one other thread where the following advice is given: "I successfully expose Windows Security dialogs after adding the "DirectUIHWND" class name to the list of accepted windows on my Windows 7 system."



I performed these steps, but this did not resolve the problem. In fact now I am seeing a recorded function that does not include my username and password, so I think it was a step in the wrong direction.



Thanks in advance for any help.
  • The test gets stuck, because it waits for the page to load completely before entering the credentials. But the page finishes loading only after it receives the credentials - which results in a lock.

    To avoid the issue, you need to navigate to the page without waiting for it to load. For example, replace this line:

    Browsers.Items(btIExplorer).Run("http://www.test.com");

    with these:

    var browserInfo = Browsers.Item(btIExplorer);
    browserInfo.RunOptions = "http://www.test.com"; // your URL
    browserInfo.Run();

     

8 Replies

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    The test gets stuck, because it waits for the page to load completely before entering the credentials. But the page finishes loading only after it receives the credentials - which results in a lock.

    To avoid the issue, you need to navigate to the page without waiting for it to load. For example, replace this line:

    Browsers.Items(btIExplorer).Run("http://www.test.com");

    with these:

    var browserInfo = Browsers.Item(btIExplorer);
    browserInfo.RunOptions = "http://www.test.com"; // your URL
    browserInfo.Run();

     

    • lytran's avatar
      lytran
      New Contributor

      Hi Helen,

       

      function Test1()
      {
      var browserInfo = Browsers.Item(btIExplorer);
      browserInfo.RunOptions = "https://myurl.com";
      browserInfo.Run();
      directUIHWND = Aliases.browser.dlgWindowsSecurity.DirectUIHWND;
      edit = directUIHWND.CtrlNotifySink2.Edit;
      edit.Drag(60, 7, -90, -7);
      edit.SetText("test");
      edit = directUIHWND.CtrlNotifySink3.Edit;
      edit.Drag(114, 10, -207, -20);
      edit.SetText("test");
      directUIHWND.CtrlNotifySink.btnOK.ClickButton();
      }

       

      I follow your suggestion, but it's till loading my site on back side, and window security is there. It doesn't input username and password.

       

      Do you have any other solutions or am I missing steps?

       

      Thanks,

      lytran

    • lytran's avatar
      lytran
      New Contributor

      Hi Helen,

       

      After I say it doesn't work, then I closed TestComplete and open again. Run test script again. It WORKS FINE

       

      Now, the issue is it does not work after it works first time. It seems like I have to close the TestComplete again and again if I want to run that use case.

       

      Any suggestion in this case???

       

      Thanks,

      lytran

      • HKosova's avatar
        HKosova
        SmartBear Alumni (Retired)

        When the Windows Security dialog is displayed, is there the Login object in the Object Browser?


        ie-login-dialog.png

        If so, remove DirectUIHWND from the MSAA settings and use a script like this:

         

        var browserInfo = Browsers.Item(btIExplorer);
        browserInfo.Run();
        browserInfo.Navigate("https://myurl.com");
        
        var page = Aliases.browser.Page("*");
        page.Login.UserName = "test";
        page.Login.Password = "test";
        page.Login.Button("OK").Click();
  • NisHera's avatar
    NisHera
    Valued Contributor
    In     project\properties\Genaral    there is a tick box "record user actions over tested aplication only" is it ticked?
  • svarog99's avatar
    svarog99
    New Contributor
    Nishnatha, the box you mention is not ticked.



    Helen, changing the code as you suggested seems to have fixed the issue.



    Thank you both for the responses!
  • I have the same problem, but I'm using Keyword recording.

    Is there a solution for this?

    Thanks.

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      The solution is the same, only with keyword tests.  You need to interact with the Login object in your keyword test as HKosova mentioned.