Forum Discussion

NyeEvans's avatar
NyeEvans
Occasional Contributor
3 years ago
Solved

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.

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 🙂

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

3 Replies

  • NyeEvans's avatar
    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

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

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

    • NyeEvans's avatar
      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()