Forum Discussion
HKosova
13 years agoSmartBear Alumni (Retired)
Hi Vinay,
TestComplete provides various search functions exactly for this purpose:
* Page.FindChild - searches for a web page element by one or more property-value pairs;
* Page.NativeWebObject.Find - searches for a web page element by its tag name and a single property-value pair;
* Page.EvaluateXPath - locates a web page element by XPath.
So, you can use any of the following - whatever you like most:
TestComplete provides various search functions exactly for this purpose:
* Page.FindChild - searches for a web page element by one or more property-value pairs;
* Page.NativeWebObject.Find - searches for a web page element by its tag name and a single property-value pair;
* Page.EvaluateXPath - locates a web page element by XPath.
So, you can use any of the following - whatever you like most:
' Searching by one property-value pair
var editBoxGoogleSearch = page["FindChild"]("idStr", "gbqfq", 15 /* search depth */);
' Searching by multiple property-value pairs
var editBoxGoogleSearch = page["FindChild"](
["TAGNAME", "idStr"], // property names
["INPUT", "gbqfq"], // property values
15 /* search depth */);
' Searching by the tag name and one property-value pair
var editBoxGoogleSearch = page["NativeWebObject"]["Find"]("idStr", "gbqfq", "input");
' Searching by XPath
var res = page["EvaluateXPath"]("//INPUT[@id='gbqfq']");
var editBoxGoogleSearch = (new VBArray(res)).toArray()[0];
Related Content
- 4 years agobryanhirst15223
- 6 years agosree2011
Recent Discussions
- 2 days agoMW_Didata