Ask a Question

Invalid variant operation

nbenitus
Contributor

Invalid variant operation

Hi,



I am doing a very basic operation, waiting for a button to be visible on screen. Here is my code:



Call installerMainWindow.btnFinish.WaitProperty("VisibleOnScreen", true, Project.Variables.long_timeout)



The long_timeout variable has been set to 10 minutes (600000).



When I run Delay(Project.Variables.long_timeout), it does wait for the full 10 minutes.



However, when I run the line entered earlier, it waits for around 1/10th of the time (around 1 minute), then, if the button is not found by that time, I get a runtime error: Invalid variant Operation.



I have no clues what it's going on. I have used the WaitProperty operation dozens of time in my project without problem.



Thanks in advance.



Benoit
7 REPLIES 7
Julia_K
SmartBear Alumni (Retired)

Hello Benoit,

Could you please specify whether the Invalid Variant Operation error occurs only for some specific objects in your tested application? Does the error occur if you call the WaitProperty method with the hard-coded time-out value?

Can you reproduce the problem when calling the WaitProperty method for another object or with other parameters?

Thank you.
I’m not a member of the SmartBear Support Team, I’m just helping users in this community.


Any views or opinions expressed do not necessarily represent those of SmartBear Software.
nbenitus
Contributor

Thank you Julia for your answer and sorry for the late reply.



I have tried recently and it seems that everything is fine. It is pretty weird as I have seen many Invalid Variant errors recently.



May I post a reply to this thread if the problem happens again?



Thanks again.



Benoit
Julia_K
SmartBear Alumni (Retired)

Hello Benoit,

May I post a reply to this thread if the problem happens again?


Yes, you certainly may.  Please do not hesitate to post to this thread if you face the same problem again.

Also, feel free to contact us on this forum or via the Contact Support web form if you come across any other problems or questions.

Thank you and good luck with your testing.
I’m not a member of the SmartBear Support Team, I’m just helping users in this community.


Any views or opinions expressed do not necessarily represent those of SmartBear Software.
Adagio
Frequent Contributor

Hello,

 

I'm encountering a similar problem, but not able to understand why..can someone please help here?

 

if (panel3.panelComponentHeader.buttonEdit.WaitProperty("Enabled", false, 15000))
{
Log.Message("Edit is enabled");
}
else
{
Log.Error("XXXXXYYYYYYYYYZZZZZZ");
Runner.Stop();
}

 

 

Thank you

Abhi

tristaanogre
Esteemed Contributor

My initial thought... are we certain that the object exists before you attempt the WaitProperty on it?  You can't call a WaitProperty method on an object that does not exist.


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
Adagio
Frequent Contributor

Thank you Robert!

My issue is that I have to wait for an object to be loaded on the page, then I want to do some actions on the controls available on that object. If I use the waitProperty on the parent object, and the script would just throw an error saying that it doesn't exist.

 

what do I do to wait for something to appear on the Web page? I don't want to use Delay() or Page.Wait() in this case. 

 

Thank you

Abhishek

tristaanogre
Esteemed Contributor

In KDT functionality, this is what the "if object" operation can be used for... to check for an object to exist within a particular time range.  Use the "if object" operation on your object to detect "Exists" not equal to true.  Then right click on the operation and set the Auto-Wait timeout to the maximum time you want to wait.  Then, add code that will execute when it comes back false to throw an error or something.

 

The effect of this is that the test will wait up to that maximum time for the object to Exist.  If it doesn't within that time, you'll log an error.  If it does, your test will proceed.

 

If, however, you are using Script code, I'd suggest using the methodology of WaitNNN methods (https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/waiting-process-or-window-a...).  


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: