Ask a Question

Ultragrid object invisible error

SOLVED
David91
Frequent Contributor

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..!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
tristaanogre
Community Hero

Re: Ultragrid object invisible error

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.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

6 REPLIES 6
tristaanogre
Community Hero

Re: Ultragrid object invisible error

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)

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
hkim5
Staff

Re: Ultragrid object invisible error

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:image.png

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

Hope this helps!

Best,
Justin Kim
David91
Frequent Contributor

Re: Ultragrid object invisible error

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

tristaanogre
Community Hero

Re: Ultragrid object invisible error

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.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

David91
Frequent Contributor

Re: Ultragrid object invisible error

great, it looks like test find him now, how is that possible? And why it didn't work for me many years ago 😄

Thank you very much anyway!!

tristaanogre
Community Hero

Re: Ultragrid object invisible error

To answer your questions:

 

Operating system changes, TestComplete version changes, etc., all probably impacted.  In version 14 of TestComplete there were some changes made in the internal logic of NameMapping that changed some of the late-binding of the objects so, when you assign the Alias to the table object, it's not "present" at that moment so the properties aren't set.  WaitAliasChild does a more dynamic search, assigning the object to the variable more accurately.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: