Forum Discussion

dammac's avatar
dammac
New Contributor
8 years ago

Window is invisible error

Hi,

 

I have problem with 'The window is invisible and thus cannot be activated.'.

Don't know why because it is visible. -> screen 01.png

This is short test recorded:

function Test2()
{
var NFZKom;
var NFZKomMainForm;
var navBarControl;
NFZKom = NameMapping.Sys.Process("NFZKom");
NFZKomMainForm = NFZKom.WinFormsObject("NFZKomMainForm");
NFZKomMainForm.WinFormsObject("BarDockControl", "", 5).WinFormsObject("DockedBarControl", "", 1).ClickItem("Polecenia|Rachunki");
navBarControl = NFZKomMainForm.WinFormsObject("MdiClient", "").WinFormsObject("RachunkiTab").WinFormsObject("dockPanel1").WinFormsObject("dockPanel1_Container").WinFormsObject("rachunkiBarControl");
navBarControl.ClickItem("Rachunek", "Nowy");
NFZKom.WinFormsObject("cmsPrint").Click(137, 10);
NFZKom.WinFormsObject("RachunekDoSzablonu").WinFormsObject("btnCancel").ClickButton();
navBarControl.ClickItem("Rachunek", "Nowy");
NFZKom.WinFormsObject("cmsPrint").Click(176, 77);
NFZKom.WinFormsObject("RachunekForm").WinFormsObject("btnCancel").ClickButton();
}

 

This works when I run test just after recording. When I restart TC or app this is not working.

I also attach objectspy ss 02.png

Tried to use: set_Visible(true) but then window blinks, TC cliscks but next window does not open and test stops. Looks like it was just empty click.

 

I also tryed to use ControlId (zero) and Id that is always different. No success.

I spoke about this with my dev team but maybe there is way to solve this.

 

Thank you, Damian.

 

3 Replies

  • So it clicks the "Nowy" button OK?

     

    So the line it fails on is: NFZKom.WinFormsObject("cmsPrint").Click(176, 77);

     

    Right?

     

    What is the "cmsPrint" object? Is this a popout form? I don't see a popout form in the screen capture from your failed test?

     

    Couple of things spring to mind:

     

    1. Timing. You are trying to click "cmsPrint" before it has had a chance to render it to the screen.

    2. Identification properties of "cmsPrint". Are you sure they are good? It's not using some sort of dynamic ID to try and identify it or something?

    • dammac's avatar
      dammac
      New Contributor

      Colin_McCrae wrote:

      So it clicks the "Nowy" button OK?

      So the line it fails on is: NFZKom.WinFormsObject("cmsPrint").Click(176, 77);

      Right?


       Yes.

       


      Colin_McCrae wrote:

      What is the "cmsPrint" object? Is this a popout form? I don't see a popout form in the screen capture from your failed test?


      It is that popout menu on screen 01 with lots of 'Rachunek' rows. Properties are on screen 02.

       

       


      Colin_McCrae wrote:
      Couple of things spring to mind:

      1. Timing. You are trying to click "cmsPrint" before it has had a chance to render it to the screen.

      2. Identification properties of "cmsPrint". Are you sure they are good? It's not using some sort of dynamic ID to try and identify it or something?


      1. I have set autodelay (500ms) in project options. Also added delay before click. Didn't help

      2. Every time it has different Id, ControlId is the same = 0.

       

      More info: as you can see on screen 01 (partially hidden) Rachunek menu has several options:

      -Nowy

      -Korekta

      -Usun

      -Podglad etc.

      When I click one, every popout menu is recognized as WinFormsObject("cmsPrint"), maybe that is the problem.

       

      If I wont find solution, I will try to force dev team to rebuild cmsPrint  ;)

      • Colin_McCrae's avatar
        Colin_McCrae
        Community Hero

        Ah. OK. I was looking for something more like a dialog box.

         

        So do you have multiple different versions of this popout mapped?

         

        If so, and their identification properties are the same, you might be better handling this dynamically.

         

        ie.

         

        • Click the menu option (works OK).
        • Search for a "cmsPrint" object (using visibility as part of your search parameters so it only finds the visible one).
        • Search within the found "cmsPrint" for the desired option.
        • Click it if found. (Log some sort of error if not ...)

         

        I have to do something like this with dynamically spawned (multi-level) Delphi context menus on a tree object.