Selector has display: none.
Im using playwright to send file like this:
await page.setInputFiles(
'//*[@id="root"]/div/div/main/div/div[2]/div[3]/input',
file);
And this is error I get:
waiting for selector "//*[@id="root"]/div/div/main/div/div[2]/div[3]/input" selector resolved to hidden
Do you know how to make it work? Thanks
You need to change the display property of the element using the evaluate method.
let inputFileSelector = await page.$('xpath=//*[@id="root"]/div/div/main/div/div[2]/div[3]/input');
await inputFileSelector.evaluate((el) => el.style.display = 'inline'); // or inherit
Or you can also do this directly as
await page.evaluate(() => { document.querySelector('mySelector').style.display = 'inline'; });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With