'Playwright - select child element innerText

I am trying to first select an array of page elements based on a common id. Then loop through them to get the innerText of an h4 child. Here is what I am trying:


    const headers = await this.page.$$("data-testid=my-custom-id");

    const rawData = await Promise.all(headers.map(async (header, i) => {
        return await (await header.$('h4')).innerText;

    }))

If I log rawData, I just see a bunch of: [AsyncFunction: innerText]

Can someone tell me what I am doing wrong?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source