Forum Discussion

kaiiii's avatar
kaiiii
Regular Contributor
7 years ago

find element by view id and wait for object exist or enabled.

need an example for find element by view id and wait for object exist or enabled...also want to know... ViewId becomes unique for every element or not

  • Hi,

     

    > what is the mean by <value> and <depth>

    These are the parameters for the .FindChildEx() method. Check the documentation for their description and use the actual values that are relevant for your given application and needs.

     

    For example, this line of code may look like this:

    var obj = root.FindChildEx('ViewId', 'abc123', 50, 30000);

    which means that it will try to find the object with the ViewId property that equals to the 'abc123' string for 30 seconds searching 50 levels deep starting from the <root> object.

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    .FindChildEx() method searches for the specified child within specified timeout. (Check documentation for detailed description and code samples.)

    Depending on your needs, you may either search for the object and then wait until its certain property gets required value (via .WaitProperty() method) or include property and its value into the search parameters list for the .FindChildEx().

    The difference between these approaches is in different result granularity.

    Sample pseudocode:

    Former approach:

    var obj = root.FindChildEx('ViewId', '<value>', <depth>, <timeout>);

    if (! obj.Exists)

      // object did not appear within <timeout>

     

    if (! obj.WaitProperty('<property>', <value>, <timeout>))

      // property did not get expected <value> within <timeout>

     

    Latter approach:

    var obj = root.FindChildEx(['ViewId', '<property>'], ['<viewValue>', <propertyValue>], <depth>, <timeout>);

    if (! obj.Exists)

      // object either did not appear within <timeout> or its property did not get expected <value> within the same <timeout>

     

     

    P.S.

    > wait for object exist or enabled

    It is senseless to wait for the object to become enabled (or wait for any other property) for the object that does not exist.

    Thus, the first verification is to check whether or not the given object exists and proceed then appropriately depending on the verification result.

    • kaiiii's avatar
      kaiiii
      Regular Contributor

      >>var obj = root.FindChildEx('ViewId', '<value>', <depth>, <timeout>);

      hi... what is the mean by value and depth pls explain...i am not finding these after object spy then how can i put values in place of these

    • kaiiii's avatar
      kaiiii
      Regular Contributor

      >>var obj = root.FindChildEx('ViewId', '<value>', <depth>, <timeout>);

       

      Hi,
      what is the mean by <value> and <depth> Please explain. I am not finding these after object spy then how can i put values in place of these

    • kaiiii's avatar
      kaiiii
      Regular Contributor

      >> var obj = root.FindChildEx('ViewId', '<value>', <depth>, <timeout>);

       

      Hi,
      what is the mean by <value> and <depth> Please explain. I am not finding these after object spy then how can i put values in place of these

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        > what is the mean by <value> and <depth>

        These are the parameters for the .FindChildEx() method. Check the documentation for their description and use the actual values that are relevant for your given application and needs.

         

        For example, this line of code may look like this:

        var obj = root.FindChildEx('ViewId', 'abc123', 50, 30000);

        which means that it will try to find the object with the ViewId property that equals to the 'abc123' string for 30 seconds searching 50 levels deep starting from the <root> object.