Forum Discussion

Gordian's avatar
Gordian
Occasional Contributor
12 years ago

Can a Flex "ClickButton" wait for..

In our application we have a number of  Flex based wizard pages where the "Next" button may take some time to become enabled.



When a script is recorded, this time of waiting for the button to become enabled is lost.  However, it seems reasonable that the auto-wait timeout for the "ClickButton" should do two things.   First it should wait for the object to exist.  Then it should wait for it to be enabled.  It would be a rare case to attempt to click a disabled button.



However, in TestComplete it only waits for the button to Exist.  If the user want to make sure it is enabled (and this is always the case for us), then the recording has to be augmented with a checkpoint.   This sort of thing slows the test automation down.



Is there anyway to help users out so that they can just record the ButtonClick and TestComplete will automatically wait for both Exists and Enabled?



I'm looking at adding an Event Analyzer for other purposes but this one seems like it should be simple to support automatically for the users without going to that level of development.   Any ideas?    Should this be a support request to add a flag that defaults to waiting for the object to be Enabled?

1 Reply

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Thomas,


     


    Everybody can have different tasks. In your case, you can easily check whether the button is enabled and only after that click it:




    var button = // obtain a button


    if (button.WaitProperty("Enabled", true, 15000))


    {


       button.ClickButton();


    }




     


    The WaitProperty method will wait until value of the Enabled property becomes True or until the timeout is over.