Forum Discussion

tlehmann's avatar
tlehmann
New Contributor
7 years ago

Testcomplete not responding while trying to commit a Dialog (Win10 Desktop Application)

Dear community,

 

I hope you can help me with the following problem. (Excuse my english)

 

While trying to commit this Dialog, testcomplete does not respond anymore after the second 

 

Aliases.Handwerk.ClientBackup.btnNext.Click();

 

 

The little dialog which  appears within the Tested Application is mapped alright but i just cannot commit it. If i try to stop the test, Testcomplete says "stopping..." but does not respond anymore. Only if i manually commit the Dialog it carries on.

 

 

 

procedure Mandantensicherung;
Var Obj: OleVariant;

begin
  Aliases.Handwerk.MainForm.dxRibbon.ClickItem('[0]|Mandanten|Mandantensicherung');
  Aliases.Handwerk.ClientBackup.btnNext.Click();
  Aliases.Handwerk.ClientBackup.btnNext.Click();
  Aliases.Handwerk.ClientBackup.LayoutControl.ed_TargetDir.TcxCustomInnerTextEdit.Keys('c:\temp');
  Aliases.Handwerk.ClientBackup.LayoutControl.edHowToSave.ClickItem('ZIP-Archiv (Normal)');
  Aliases.Handwerk.ClientBackup.btnNext.Click();
  Delay(2000);
  Aliases.Handwerk.ClientBackup.btnNext.Click();
  //At this Point Testcomplete does not respond anymore. If i manualy stop the test it says "stopping..." and stays like that.
  //I need to comit that "informations" Window somehow but not even the delay gets executed
  Delay(2000);
  //This ist the Object i am trying to commit
  Obj:=Sys.Process('Handwerk').Window('#32770', 'Informationen', 1);
  Obj.Keys('[Enter]'); 
end;

 

 

 

One last information which might be helpful:

 

  1. If i manually navigate  through the Assistent until the Dialog with the 'ok' Button appears i can commit it by starting the following procedure within Testcomplete:

 

 

 

begin
 Obj:=Sys.Process('Handwerk').Window('#32770', 'Informationen', 1);
 Obj.Keys('[Enter]'); 
end;

 

 

2. If i do not use the Aliases.Handwerk.ClientBackup.btnNext.Click(); and  instead use a tdxbarcontrol.click with coordinates the whole thing works fine. This procedure runs fine and commits the last Diaolog as it should. However i cannot work with coordinates as the test has to run on different clients with different screen resolution.

 

 

 

procedure Test14;
  var handwerk : OleVariant;
  var tdxBarControl,Obj : OleVariant;
  
begin
  handwerk := Aliases.Handwerk;
  tdxBarControl := handwerk.ClientBackup.dxBarDockControl1.TdxBarControl;
  tdxBarControl.Click(184, 12);
  tdxBarControl.Click(184, 12);
  Obj:=Sys.Process('Handwerk').Window('#32770', 'Informationen', 1);
  Obj.Keys('[Enter]'); 
end;

 edit: I also tried it with the mapped name, no differenz as the script does not seam to get to that point.

 

5 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    My guess is that the various "Next" buttons are actually Next buttons on a redrawn form.  Basically, you click "Next" and then the form reloads and you click "Next" again and so on.  What is probably happening is that the automation is running faster than the application can handle it so one of your "Next" clicks is happening on the previous button.  You might want to build some delays into your automation to detect when the next form is displayed before proceeding through the test. 

    • tlehmann's avatar
      tlehmann
      New Contributor

      Hi Robert,

      Thanks for your reply. I just tried it, but unfortunatly with the same problem.

       

      Regards,

      Thomas.

       

      begin
        Aliases.Handwerk.MainForm.dxRibbon.ClickItem('[0]|Mandanten|Mandantensicherung');
        Delay(3000);
        Aliases.Handwerk.ClientBackup.btnNext.Click();
        Delay(3000);
        Aliases.Handwerk.ClientBackup.btnNext.Click();
        Delay(2000);
        Aliases.Handwerk.ClientBackup.LayoutControl.ed_TargetDir.TcxCustomInnerTextEdit.Keys('c:\temp');
        Delay(3000);
        Aliases.Handwerk.ClientBackup.LayoutControl.edHowToSave.ClickItem('ZIP-Archiv (Normal)');
        Delay(3000);
        Aliases.Handwerk.ClientBackup.btnNext.Click();
        Delay(3000);
        Aliases.Handwerk.ClientBackup.btnNext.Click();
        Delay(3000);
        Obj:=Sys.Process('Handwerk').Window('#32770', 'Informationen', 1);
        Obj.Keys('[Enter]'); 
      end;
      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        My guess, then, is that this last Information window is a modal dialog.  

         

        I'm not sure why this is happening... according to the documentation, everything should work smooth.

         

        Suggestion: Instead of "Click" try "ClickButton" and see if it works better.

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    > Aliases.Handwerk.ClientBackup.btnNext.Click();

    > Obj:=Sys.Process('Handwerk').Window('#32770', 'Informationen', 1);

    Suggested quick fix:

    Change

    Aliases.Handwerk.ClientBackup.btnNext.Click();

    to

    Aliases.Handwerk.ClientBackup.Button('OK').Click();

    or, even better, to

    Aliases.Handwerk.Window('#32770', 'Informationen').Button('OK').Click();

     

    Explanation:

    Window of #32770 class is a generic Windows OS message window that is widely used in desktop applications.

    Considering that your code tries to deal with the Aliases.Handwerk.ClientBackup.btnNext object, it is very likely that some notification window was previously displayed, processed and namemapped. According to the aliased object names, these were 'Client Backup' window with the Next button. Mapping attributes used to namemap the above objects appeared to be not unique and appeared to match those for the 'Informationen' window and OK button. That is why the code was recorded to deal with the ClientBackup and Next aliased objects.

    Note, that all other versions of your code do not try to use the ClientBackup object and work with the current instance of the #32770 window.

    Now, the tricky part: if ClientBackup window already does not exist in your application (i.e. if the window was destroyed when closed), you had to get the error in the test log that ClientBackup alias was not found. But as you did not get this error and TestComplete seems to try to do something with the Next button of the ClientBackup window, this makes me think that the window still exists in the application's memory. You may use Object Browser in TestComplete and check whether or not the ClientBackup object exists in the application's objects list right before execution of the problematic line of code.

    If the object exists, I would recommend to talk to developers and ask them whether this is intentional or if this is a kind of memory leak that must be corrected.

     

    In any case, the line of code that breaks your test seems to be dealing with wrong objects and must be corrected.

     

    P.S. http://support.smartbear.com/testcomplete/docs/scripting/calling-methods-asynchrounously.html might be a good reading, but I am not sure that this is your case.