Find and Use a Sibling Object Starting from an AliasChild Object
I am attempting to find an object that is located directly next to an initial object. The way I am attempting to do this is by trying to get the .Parent of the initial object, then attempting to do a WaitPanel Function call on the parent object to locate the desired child. Though in attempting this, it is unable to find the Panel object.
Both the Desired Object and Parent Container do not have an static ID or class that can assist directly with object discovery, and the text inside this "Panel(0)" object changes on every instance.
For Example:
let anchorobj = [PathToProcess.Page].WaitAliasChild("MappedName", 1000); //This is our Panel(1) object, this is found successfully and hence can be used without issue
let parent = anchorobj.Parent; //I want this to be the Panel(2) object the anchorobj is nested in, though this does not seem to be true
let desiredobject = parent.WaitPanel(0, 1000); //This is creating a Utils.CreateStubObject() as far as I can tell where desiredobject.Exists == false; I want this to get the Panel(0) object marked as Desired Object
Is there a better/more correct way to do this method of attempting to get this object?
Alright, figured it a solution. Though I doubt this is the optimal method
So to get the actual Parent Object, it needs to use ".parentNode" (or ".parentElement"), though as this is browser based javascript element, it does not create the "TestComplete Object", hence using this will cause parent.Exist == false. So once I have gone up enough levels to reach the parent I want (in the example it's only the one level), I can then take the class of the object (that changes every run with Electron's Code Obfuscation), do a WaitElement searching for an element with that Class Name, and then I can do the WaitPanel to find the desired object.For Example:
let anchorobj = [PathToProcess.Page].WaitAliasChild("MappedName", 1000);
let parentclass = anchorobj.parentElement.className;
let parent = [PathToProcess.Page].WaitElement("contains(@class, '" + parentclass+ "']", 1000);
let desiredobject = parent.WaitPanel(0, 1000);I'll leave this open for a couple days in case anyone knows a more optimal solution