Hi, I have a react-native application where I need to get the child elements of an element, the things that I’ve tried as the following:
I have a function to check for an element and it supposed to return a list of elements
private async getComponents(client: any, component: string) {
let elements = await client.findElements('accessibility id', component);
Object.keys(elements).forEach(function(key) {
let val = elements[key];
console.log(`val: ${val}`);
});
for (const [key, value] of Object.entries(elements)) {
console.log(`key:${key} | value:${value}`);
}
return elements;
}
Some output information regarding the function:
- typeof elements: object
- elements.length: 0
- elements.values(): [object Array Iterator]
The thing is that I am not able to iterate over the “elements” variable (which is an object) to corroborate that there are the child elements that I am looking for, the methods to iterate inside the functions does not work
This is the element that have the child on it