Forum Discussion

David91's avatar
David91
Frequent Contributor
5 years ago
Solved

Ultragrid object invisible error

Hi, I have problems with an object ultragrid Seky_tabulka that is visible but when performing the test the face is invisible and test script doesnt see it.. Object sppy detect visible is true..

 

var table = Aliases.ShellForm.MainWorkspace.WorkingMainView.m_tableLayoutPanelMain.m_panelLeft.LeftWorkspace.TableLayoutDynamicView.m_tableLayoutPanel.BoundedDynamicViewPanel.UltraGridViewControl.m_ultraGrid;

 

table.Visible;
var r_Mena = table.FindRow(0, KOD_SEK);

 

interestingly, it worked before.. 🙂 Thanks for your advice..!

 

 

  • HRm...  is the error you're getting that the object is not visible?  Or is it the error you're getting that he object does not exist?

     

    If it's an existence problem and not a visible problem, try the following change to your code.

    var table = Aliases.ShellForm.MainWorkspace.WorkingMainView.m_tableLayoutPanelMain.m_panelLeft.LeftWorkspace.TableLayoutDynamicView.m_tableLayoutPanel.BoundedDynamicViewPanel.UltraGridViewControl.WaitAliasChild("m_ultraGrid", 20000);
    
    if !table.Exists {
        Log.Message("Unable to find ultraGrid table")
    }
    else {
        var r_Mena = table.FindRow(0, KOD_SEK);
    }

     

    The problem very well might be in FINDING the object, not in it's visibility.  The "WaitAliasChild" does an active search and wait up to the timeout to determine if the object is even present in memory.  If the object returns within the timeout, then the result of WaitAliasChild is the object itself.  If the object does NOT return, then the result of WaitAliasChild is a "stub" object with only the "Exists" property and that property set to false.

     

    Give this a try and report the results.

6 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Timing is most likely the issue.  The object may become visible after a time rather than immediately and since script runs faster, sometimes, than applications, you need to account for that.  I'd inject a "WaitProperty" call on the grid before you try and use table something like

     

    table.WaitProperty("Visible", true, 10000)
  • I agree with tristaanogre that this is most likely a timing issue where TestComplete is moving too fast before a certain object required for an action is rendered. And the wait properties are always a good method of making sure that the object or its child is present before following through with a certain action. However, if you don't want to script, you may just want to slow TestComplete down a smidgen, then you can just adjust your project settings to widen the time gap between your actions:

    tools - current project properties- playback: delay between events, ms (maybe go from 50 to 150? that should be plenty)

    Hope this helps!

    • David91's avatar
      David91
      Frequent Contributor

      I tried both designs but still can't find the ultragrid .. I don't get it, test worked well before

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        HRm...  is the error you're getting that the object is not visible?  Or is it the error you're getting that he object does not exist?

         

        If it's an existence problem and not a visible problem, try the following change to your code.

        var table = Aliases.ShellForm.MainWorkspace.WorkingMainView.m_tableLayoutPanelMain.m_panelLeft.LeftWorkspace.TableLayoutDynamicView.m_tableLayoutPanel.BoundedDynamicViewPanel.UltraGridViewControl.WaitAliasChild("m_ultraGrid", 20000);
        
        if !table.Exists {
            Log.Message("Unable to find ultraGrid table")
        }
        else {
            var r_Mena = table.FindRow(0, KOD_SEK);
        }

         

        The problem very well might be in FINDING the object, not in it's visibility.  The "WaitAliasChild" does an active search and wait up to the timeout to determine if the object is even present in memory.  If the object returns within the timeout, then the result of WaitAliasChild is the object itself.  If the object does NOT return, then the result of WaitAliasChild is a "stub" object with only the "Exists" property and that property set to false.

         

        Give this a try and report the results.