cancel
Showing results for 
Search instead for 
Did you mean: 

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

SOLVED
Highlighted
Regular Contributor

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

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

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.

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

5 REPLIES 5
Highlighted
Community Hero

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.

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
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

Highlighted
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

Highlighted
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

Highlighted
Community Hero

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.

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!


Challenge Status

Get properties of a web page element

Participate!

Compare images using the Region Checkpoint

See replies!

Compare HTML table with Excel file and correct data in Excel file

Participate!

How to execute remote test and obtain results via Test Runner REST API

Participate!
Top Kudoed Authors