Ask a Question

TestComplete waits for object before using it for the first time

SOLVED
NyeEvans
Occasional Contributor

TestComplete waits for object before using it for the first time

Hi all, I've got this snippet of code:

 

Aliases.browser.pageSecuritydetails.formSecurityDetails.passwordbox2TheAnswerIsAnswer.Click();
Aliases.browser.pageSecuritydetails.formSecurityDetails.passwordbox2TheAnswerIsAnswer.WaitProperty("Enabled", true, 500);
Aliases.browser.pageSecuritydetails.formSecurityDetails.passwordbox2TheAnswerIsAnswer.SetText(Answer);

 

When running this code, TestComplete will "wait for object" for about 20 seconds as if it can't find the object and then run the first line, after that it will run the rest of the lines fine and always find the object. This always happens no matter what the first line is, anything that uses this object will want to wait first.

NyeEvans_0-1642162939197.png

I've tried refreshing the namemap and/or the object hierarchy before hand using the below lines and it will still do this wait before even doing those

 

Aliases.browser.pageSecuritydetails.formSecurityDetails.passwordbox2TheAnswerIsAnswer.Refresh();

Aliases.browser.pageSecuritydetails.formSecurityDetails.passwordbox2TheAnswerIsAnswer.RefreshMappingInfo();

 

Does anyone have any idea how I could stop this happening? This script is run before all our tests and its significantly slowing things down

 

I've attached the full script

 

Thank you all πŸ™‚

3 REPLIES 3
Marsha_R
Community Hero

If you step through these three lines of code using Debug, where do you see the waiting actually happening?


Marsha_R
[Community Hero]
____
[Community Heroes] 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 Heroes]
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 Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
NyeEvans
Occasional Contributor

stepping through it the wait happens when the first line that uses this object runs, so in the code above it runs on click()

NyeEvans
Occasional Contributor

Ok, I switched from using web objects (Xpath and css selectors) to just using TestComplete objects and its solved the issue, not sure why

cancel
Showing results forΒ 
Search instead forΒ 
Did you mean:Β