Forum Discussion

superuser's avatar
superuser
Occasional Contributor
13 years ago

Generic function that checks the available button on Screen and follow routine.

Hello,

Can anyone help me out. I need to write the function which checks the available buttons in screen at run time and follow the routine according to the button found.

The flow is like once we reached the screen and found that Start button then follow the routine accordingly later again if we reached on the same screen and found Up and Down button then follow the routine accordingly.

Immediate help would be much appreciated.

Thanks

3 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    not knowing what language you're writing in, it's difficult to give you specifics.  



    Your chief function of use will be a FindAllChildren method call within your function to find all child objects of the current screen that are of a button class.  This will return an array and you can then check that array for your different buttons and execute code using some sort of "case" type logic.
  • superuser's avatar
    superuser
    Occasional Contributor
    Thanks for reply Robert

    let me explain clearly I need to write a function which reads the buttons wndcaption/wtext or some other unique property on the web page and if property matches it follows the some routine.
  • Hi Satish,


    As Robert has already mentioned, you can use the FindAllChildren method to find needed elements on the web page. This method searches for all child objects that have specified values of specified properties. For example, to find all edit boxes on the application's form, you can use the following statement:




    textBoxes = w.FindAllChildren("WndClass", "Edit", 5);


    The code will return an array of edit boxes, then you can perform needed actions with each element of the array.


    To see examples of using the FindAllChildren method, please refer to http://smartbear.com/support/viewarticle/12741/ in the online documentaton.

    Also, please read Finding Objects on Web Pages.