Forum Discussion

cjfoeller0404's avatar
cjfoeller0404
Occasional Contributor
24 days ago
Solved

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...
  • cjfoeller0404's avatar
    24 days ago

    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