Forum Discussion

RajeshMenghani's avatar
RajeshMenghani
New Contributor
4 years ago
Solved

Why TestComplete cannot detect object to enter credentials on windows security popup of mstsc

Automate the process to launch rdp connection(via mstsc) and connect to VM machine. Issue was that mstsc launches Windows security pop up and testcomplete could not reach to password textbox.
  • RajeshMenghani's avatar
    4 years ago

    Resolution:

    Capture Windows security popup as Edge browser object, and bring focus of Testcomplete to Windows security pop up

  • RajeshMenghani's avatar
    RajeshMenghani
    4 years ago

    Code extract:

        vProcess = Sys.Process("mstsc");

        mProcess = Sys.Browser("edge").Login;   // windows security window when user clicks connect button on mstsc

       

        //machine name

        exestatus = mvObjects.enterEditText(vProcess, "Window(\"Edit\", \"\", 1)", machine_to_connect,exestatus);

     

       

         //more options link

        exestatus = mvObjects.buttonClick(vProcess, "Name", "Window(\"ToolbarWindow32\", \"\", 1)",exestatus);

        Sys.Desktop.Keys("[Tab]");

          

        //username

        exestatus = mvObjects.Fullnametext(vProcess, "*Window(\"#32770\", \"General\", 1).Window(\"#32770\", \"Credentials\", 1).Window(\"Edit\", \"\", 1)",username,exestatus);

       

        //click connect button

          exestatus = mvObjects.buttonClick(vProcess, "Name", "Window(\"Button\", \"Co&nnect\", 3)",exestatus);

       

        exestatus = mvObjects.objectFocusClickMstsc(mProcess, "WndCaption","Windows Security",exestatus);

      

         Sys.Desktop.Keys(password);

     

    Function:

    function objectFocusClickMstsc(searchProcess, propertyName, findObject,exestatus) {

     

    if (equal(exestatus,true)) {

     

          control = searchProcess.Find(propertyName, findObject, 1000);

          if (control.Exists) {

                control.SetFocus();

                control.click();

         Log.CheckPoint("Button is focused on '"+ findObject+"' and  clicked.");

      

          } else {

                Log.Error("objectFocusClick","The object was not found. objectHover function. object: " + findObject);

        exestatus = false;

          }

     

      }

     

    else {

      Log.Message("objectFocusClick","The action is skipped since the execution status is set as '"+exestatus+"'");

     

      }

      return exestatus; 

     

     

    } // objectFocusClick