cancel
Showing results for 
Search instead for 
Did you mean: 

How to wait for a button to continue

SOLVED
Highlighted
Frequent Contributor

How to wait for a button to continue

Hello, I am new to TestComplete and scripting, please forgive me asking stupid questions.

 

I have a test that is going to click on a button on a web page, which will take me to the next page, and I will need to click on another button on the second page to continue the test. However, if I just script 2 click actions, it will perform the first click, and error out on the second click saying because the object not exist, so I guess it may need to take a few seconds to load the second button, so I used waitproperty method, but it still don't work, I can see the button is showing on the page and enabled, but the waitproperty method just keep waiting and waiting and then times out.

 

Here are my VBscripts, can anyone please help me out?

 

Sub test

Aliases.browser.WebStore_BillingInformation.ContinueButton.Click
If Aliases.browser.WebStore_BillingInformation.ProceedWithOrder.WaitProperty("Enable", True, 20000) Then
Aliases.browser.WebStore_BillingInformation.ProceedWithOrder.Click
Else
Log.Message "Button Not Found"
End If

End Sub

3.png

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: How to wait for a button to continue

Rather than 

If Aliases.browser.WebStore_BillingInformation.ProceedWithOrder.WaitProperty("Enable", True, 20000) 

 

I would do the following

 

If Aliases.browser.WebStore_BillingInformation.WaitAliasChild("ProceedWithOrder", 20000).Exists

 

first to make sure that the object DOES exist within the appropriate timing.

 

Secondly, then I'd add the check for "Enabled"... note that the property name is Enabled not Enable.  There is a difference.


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

2 REPLIES 2
Highlighted
Community Hero

Re: How to wait for a button to continue

Rather than 

If Aliases.browser.WebStore_BillingInformation.ProceedWithOrder.WaitProperty("Enable", True, 20000) 

 

I would do the following

 

If Aliases.browser.WebStore_BillingInformation.WaitAliasChild("ProceedWithOrder", 20000).Exists

 

first to make sure that the object DOES exist within the appropriate timing.

 

Secondly, then I'd add the check for "Enabled"... note that the property name is Enabled not Enable.  There is a difference.


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

Highlighted
Frequent Contributor

Re: How to wait for a button to continue

Thank you very much, tristaanogre!! That solved the problem

New Here?
Join us and watch the welcome video:
Announcements
Script Wanted
A new challenge is here!

Create a function to drag one element to another for the TechCorner tag!

Will you dare to take the challenge?


Scripts created in July:
- Passing custom command-line arguments as a test parameter
Top Kudoed Authors