Forum Discussion

srikanth2801's avatar
srikanth2801
Contributor
14 years ago

waiting for a swing button and click if it is enabled in single step

hi, we are testing the java application.



is there any possibility to wait for a button until it is enabled and click on that button after it is enabled




objDlg.WaitSwingObject("JButton", "OK", -1,2000).Click();




iam using this and it is not waiting till the object is enabled.



help me to sort this issue




4 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Srikanth,



    No, this is not possible because object existance and object's Enabled state are completely different entities. For example, the Next button can exist but be disabled until the 'Accept EULA' check box is 'ticked' (this is an implementation of almost any installer). That is why I see no reason to combine these two verifications into one action on the tool's level.

    If the logic of your application often needs to wait for some object to appear and then wait until the appeared object becomes enabled you can create a function that implements these actions (with optional necessary intermediate verifications) and call this function when required.

    Consider implementing this function as a custom script extension checkpoint (see the relevant help topic for more details) if you like to insert the call to this function when recording the script.
  • hi this is srikanth,



    that means i need to put two steps for that.



    one is with the waitproperty('isenabled')



    and the other step is for click.



    plz post reply



    thanks in advance
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Srikanth,



    Yes, you are correct. But you can wrap these two lines as a function (as I already wrote) that will result in one line of function call in all your scripts.