I'm trying to set the innerText of an HTML element in a Puppeteer test environment and cannot (easily) get the element by CSS selector, so I'm getting the elementHandle via:
let [ el ] = await page.$x(`//span[contains(text(), 'addTestFile.pdf')]`)
I normally set innerText for testing purposes using evaluate, but I need a selector for that, e.g.:
await page.evaluate(() => document.querySelector('mySelector').innerText = '⚠️DOM modified for testing purposes⚠️')
Can I set innerText of a given elementHandle without a CSS selector?
I see I can get the value with await el.getProperty('innerHTML') but I'm not finding a way to set it.