Forum Discussion

whuang's avatar
whuang
Regular Contributor
5 years ago
Solved

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

Thanks

  • 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.

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    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.

    • whuang's avatar
      whuang
      Regular Contributor

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