pkudrys
20 days agoFrequent Contributor
FindAll returns only one (first) element
Hi guys,
I'm experiencing a weird problem. I have a mapped element, from which I need to get an array of elements. If tested in chrome/edge dev mode, the xpath of mapped element happily returns number of elements. But FindAll returns only one (first) element. Here is the code I'm using:
function CompareElementsWithRefJSON(createNewRefFiles, setElementFlag, headerInputs, tabInputs, autocompleteMenu, selectPopUpMenu, tabsData, filePath)
{
let headerItems = headerInputs.FindAll('type','*',5000);
headerItems = headerItems.toArray();
...
}
I have a workaround, using FindElements, which works OK, but I don't like it, because it's unnecessary complicated:
function CompareElementsWithRefJSON(createNewRefFiles, setElementFlag, headerInputs, tabInputs, autocompleteMenu, selectPopUpMenu, tabsData, filePath)
{
let formInputsXpath = GetXpathFromAlias(headerInputs); // This returns xpath of mapped alias object
let headerParent = headerInputs.Parent; // Get parent element
let headerItems = headerParent.FindElements(formInputsXpath); // Returns array of elements. Works OK.
...
}
So, any idea why FindAll returns just one element? BTW, it does not matter what PropName I use as the first parameter. The result is the same. Always just one element.