Forum Discussion
Another reason for not liking XPath, it would never located the correct object in the Object Browser!
If you were to Highlight, is TestComplete able to locate your mapped object i.e. Aliases.browser.Main_PAGE.DescartesRoutePlanner_SECTION.Asset_Header_FRM.Asset_Form_Header_IPTs on the UI?
If yes, are you able to try the following snippets of code in a separate function,
// Also try with a different object/property
// Test 1
var obj = Aliases.browser.Main_PAGE.DescartesRoutePlanner_SECTION.Asset_Header_FRM.Asset_Form_Header_IPTs.FindAll("type", "*", 100);
Sys.HighlightObject(obj);
Log.Message(`Number of objects ${obj.length}`);
// Test 2
var obj = Aliases.browser.Main_PAGE.DescartesRoutePlanner_SECTION.Asset_Header_FRM.FindAll("type", "*", 100);
Sys.HighlightObject(obj);
Log.Message(`Number of objects ${obj.length}`);
// Test 3
var obj = Aliases.browser.Main_PAGE.DescartesRoutePlanner_SECTION.FindAll("type", "*", 100);
Sys.HighlightObject(obj);
Log.Message(`Number of objects ${obj.length}`);
Does it highlight the correct object in question, and does it return more than one object matching the criteria?
I'm just trying to mimic what you have done. I have a mapped object using XPath, and I'm referring to that object using aliases. FindAll and FindElements return the same number of objects based on the criteria search
- pkudrys9 days agoFrequent Contributor
Hi,
Thank you for your investigation and help! I really appreciate it.
The Test 2 is closest to what I want. The thing is it returns all inputs from given form, not just those specified with my xpath. So it's not usable for my needs. I would have to specify an array of FindAll properties, which is not something I want to do. Anyway, I have a workaround using the Parent function. Not nice, but functional.
BTW, sys.highlight fails with "type error", because obj is in fact array, even if it returns only one element. It only works if I specify the obj with array index.
- rraghvani9 days ago
Champion Level 3
You can also include multiple objects and property values e.g. FindAll(["ObjectType", "Enabled", "contentText"], ["Button", "True", "Default*"], 100) to search for objects matching that criteria in Aliases.browser.Main_PAGE.DescartesRoutePlanner_SECTION.Asset_Header_FRM
My copy and paste of "Sys.HighlightObject(obj);" didn't go to plan!