Forum Discussion
Ravik
10 years agoSuper Contributor
Hi purush reddy,
Please refer how to use find Child method -
1- Find : - This method is used to search the object from the TestedObj hierarchy.This method searches an object with the specified values of the specified properties. here search starts from TestedObj parent node and continue upto the depth mention.
Syntax
Set myObject = TestObject.Find(PropertyName, PropertyValue, Depth)
Example - Suppose I want to search "gmail link" on google page, So I will write code as below
Set lnkgmail = Sys.Browser("IExplorer").Page("google.com").Find("ContentText", "gmail", 10)
Here -
1- Property Name = ContentText
2- Property Value = gmail
3- Depth = 10
2- FindChild : - A TestedObj may have one or more child objects with specified values of the specified properties so in this case we will using FindChild Method. FindChild method searches child objects from the TestedObj.
Syntax -
Set myObject = TestObject.FindChild(PropertyName, PropertyValue, Depth)
Note - The difference between Find and FindChild is that, FindChild searches child objects, while Find searches TestedObj only.
3- FindAll : - FindAll method is used to search desire object from the TestedObj hierarchy. FindAll Method searches the entire object that have Specified value of the Specified properties. it's return a collection of objects and stored entire object list into an Array.
Syntax -
Set myObject = TestObject.FindChild(PropertyName, PropertyValue, Depth)
4- FindAllChildren : – FindAllChildren method is same as FindAll method (as mention above), it will search all the children and store them into an Array.
Set myObject = TestObject.FindAllChildren(PropertyName, PropertyValue, Depth)
Note - We can search a object with the combination of multiple properties and values. Suppose we want to search gmail link which is enabled on page, so in this case we will need to define arrays for Property Name and Property Value and use them like below-
Example
PropertiesName = Array ("ContentText","ObjectType", "Enabled")
PropertieValue = Array("gmail","Link", "True")
Set myObject = TestObject.FindChild(PropertiesName, PropertieValue, 100)
5- ChildCount : - An application, TestedObj may have one or more child like Processes is a child of Sys , Windows/Page is a child of process and so on. ChildCount property returns the number of children of the TestedObj.
Syntax -
getChildCount = TestObject.ChildCount
6 waitchild -
Please refer how to use find Child method -
1- Find : - This method is used to search the object from the TestedObj hierarchy.This method searches an object with the specified values of the specified properties. here search starts from TestedObj parent node and continue upto the depth mention.
Syntax
Set myObject = TestObject.Find(PropertyName, PropertyValue, Depth)
Example - Suppose I want to search "gmail link" on google page, So I will write code as below
Set lnkgmail = Sys.Browser("IExplorer").Page("google.com").Find("ContentText", "gmail", 10)
Here -
1- Property Name = ContentText
2- Property Value = gmail
3- Depth = 10
2- FindChild : - A TestedObj may have one or more child objects with specified values of the specified properties so in this case we will using FindChild Method. FindChild method searches child objects from the TestedObj.
Syntax -
Set myObject = TestObject.FindChild(PropertyName, PropertyValue, Depth)
Note - The difference between Find and FindChild is that, FindChild searches child objects, while Find searches TestedObj only.
3- FindAll : - FindAll method is used to search desire object from the TestedObj hierarchy. FindAll Method searches the entire object that have Specified value of the Specified properties. it's return a collection of objects and stored entire object list into an Array.
Syntax -
Set myObject = TestObject.FindChild(PropertyName, PropertyValue, Depth)
4- FindAllChildren : – FindAllChildren method is same as FindAll method (as mention above), it will search all the children and store them into an Array.
Set myObject = TestObject.FindAllChildren(PropertyName, PropertyValue, Depth)
Note - We can search a object with the combination of multiple properties and values. Suppose we want to search gmail link which is enabled on page, so in this case we will need to define arrays for Property Name and Property Value and use them like below-
Example
PropertiesName = Array ("ContentText","ObjectType", "Enabled")
PropertieValue = Array("gmail","Link", "True")
Set myObject = TestObject.FindChild(PropertiesName, PropertieValue, 100)
5- ChildCount : - An application, TestedObj may have one or more child like Processes is a child of Sys , Windows/Page is a child of process and so on. ChildCount property returns the number of children of the TestedObj.
Syntax -
getChildCount = TestObject.ChildCount
6 waitchild -
This method delays script execution until the specified child object appears in the child list or the specified time limit is reached. let consider in your page you have a "Site Map" item at bottam of the page, so first you create a object for "Site Map" using Find, FindChild, FindAll, FindAllChildren as explain above.
Now suppose you want to delay script execution until "Site Map" is not loaded at that time you can use this method
If TestObject.WaitChild(YourObjName, 300).Exists Then
' Child object exists
Else
' There is no such a child
End If
Thanks
Related Content
- 4 years agoSuperTester
Recent Discussions
- 4 hours agoSvetaG