DelphiScript runtime error on: .GetColumn('name').Index
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
DelphiScript runtime error on: .GetColumn('name').Index
Hi SM-TestComplete Community,
First of all, here are some general info:
---
TC language: DelphiScript
Testcomplete Version: 14.20.2175.7 x64
OS: MS WIN 10 Pro 64-bit
The AUT (Desktop) is built in Delphi 7.
---
The object UT is a grid (inherited from TCustomGrid) and we want to get the column index like .GetColumn('name').Index + 1.
1. As we run the single script, it doesn't raise any exception, it works well.
The single script is of course one of a more complex test project.
2. But when we run the whole project then we got (see attached *.jpg) this DelphiScript runtime error Exception.
3. But this is further to consider: when we call exactly the same script in another TC-project in order to perform the foreseen actions (on the exactly same grid), in this case it doesn't raise any runtime exception. This is the main aspect we wish to clear.
The AUT (Desktop) is exactly the same.
In the attached file (*.jpg) you can see some more details of the our DelphiScript and runtime error.
Many thanks in advance and have a nice day
Best regards
Antonini E.
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The image you have embedded is too small and is hard to read for the forum. Could you attach the image rather than embed into your message or take the image at a higher resolution?
Also, simply the error text would be helpful.
Additionally, it would be good to know the code around it. It might be that everything about the single line is just fine but the context in which it is called is problematic. So, a copy/paste of your code snippet would be helpful.
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I attached the same picture, maybe it is now better to see.
The error text is: "An Exception occurred: 0xC0000096; class: ; description: ".
<So, a copy/paste of your code snippet would be helpful.>
-- START SNIPPET
procedure einenBeliebigenMandantenLoeschenAberNichtDenDemoDatenMandanten();
var
i, mandantenAnzahl, ColumnVerzeichnisIndex: Integer;
lVerzeichnis: String;
const
MAX_ANZAHL_MANDANTEN = 15;
begin
lVerzeichnis := ProjectSuite.Variables.DemoDatenMandantenPfad;
if NOT Aliases.Lohn.FMandantenanlage.Exists then
begin
Aliases.Lohn.FSMenu.MDIClient.Keys('~fm');
end;
Aliases.Lohn.FMandantenanlage.Maximize;
Aliases.Lohn.FMandantenanlage.Panel1.NO_1.TS_Mandanten.GR_Mandant.Keys('^[Home]');
mandantenAnzahl := Aliases.Lohn.FMandantenanlage.Panel1.NO_1.TS_Mandanten.GR_Mandant.RowCounter;
ColumnVerzeichnisIndex := Aliases.Lohn.FMandantenanlage.Panel1.NO_1.TS_Mandanten.GR_Mandant.GetColumn('Pfad').Index + 1;
-- END
Thank you.
E.A.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Whoops! Accidentally marked as solution... sorry...
In any case, a couple of things:
1) You're doing a Ctrl-Home on the grid first. I'm assuming that's doing some sort of refresh or other action? Is it possible that the grid is not ready at that point for you to do the GetColumn information? What's the value of mandantenAnzahl at that point?
2) There could be other issues with the componet not being found, that it might not be ready at that point, taht you might have lost the handle, etc. Try calling a RefreshMapping method off the grid before you do the GetColumn
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Robert,
I'll try with RefreshMapping and then I'll come back. But please consider again the point 3. of my first post, since in another TC-Project, calling the same script on the same object it seems, - I tried/tested it more than one time - not to raise an exception at all.
Many thanks again.
Regards
E.A.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is it the exact same code? Or are you calling "GetColumn" in a different function/procedure? That's why I'm wondering if it's something contextual.
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
One more thing to try:
> Aliases.Lohn.FMandantenanlage.Maximize;
> Aliases.Lohn.FMandantenanlage.Panel1.NO_1.TS_Mandanten.GR_Mandant.Keys('^[Home]');
There is a possibility that GR_Mandant object is not focused and thus keys are not processed by it.
Try this:
Aliases.Lohn.FMandantenanlage.Maximize;
Aliases.Lohn.FMandantenanlage.Panel1.NO_1.TS_Mandanten.GR_Mandant.Focus;
Aliases.Lohn.FMandantenanlage.Panel1.NO_1.TS_Mandanten.GR_Mandant.Keys('^[Home]');
/Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi AlexKaras,
thanks for your suggestion; I will try today and then I will replay.
Our nightly test on this point shows again that an Exception raised (now I handled with try-except block and warning message); the point is but that the same function in another project on the same object (see point 3 of my first posting) raised no Exception. The context plays a rule and I have perhaps also to consider/analyse that.
Have a nice day and best regards
E. Antonini
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
we are calling exactly the same procedure (as Unit Reference and procedure calling) in another TC-Project (inside it there are other/different Test Items since it is very similar but with some “peculiarities” to check) where but at the end we are testing the same “GR_Mandant” object on which exactly the same action are performed.
I just verified if the "GR_Mandant" Grid is focused (as suggested by @AlexKaras) and this is the case, it is actually focused. I want check now the context which maybe play a rule in all that issue.
Best Regards
E.A.
