Hi,
I'm working on a webform-filling method (Angular based) and the mapped object points to multiple elements (labels). The form is not just a single page full of inputs, but it consists of header and tab-based section (mutliple tabs, full of different inputs). To make things even more complicated, the form design regularly changes. And as a bonus, the inputs does not have (most of them) unique or usable IDs.
So I have a method, which gets all form labels, match them with related inputs and then fill the inputs with values stored in CSV file. The method can also save inputs to csv files. I'm using it also for creating new ref. data.
So, I have a mapped element for header and tab(s) section, from which I search for all labels, using FindElements method. And for this, unless I missed something, I need the xpath.
let listOfObjects = mappedElement.FindElements(xpathFromMappedObject); // where mappedElement points to onscreen object, either header or tab, and xpathFromMappedObject points to xpath of mapped element, containing all labels for given header or tab
I then cycle through the list of returned elements and do whatever is required to set or get their values. Hope it makes it clearer? 🙂 If there is a better way, I'm all ears. Of course, I'm aware that I can type the xpath directly to code, or assign the xpath as a method parameter. But I prefer using object mapping, instead of hardcoding xpath in code or test modules.
Basically, I don't want to record or manually map and handle all individual input elements 😉 I've originally developed this method for Ranorex and now I'm working on TC version.