This thread is trying to answer question "How can I toggle the visibility of an element using JavaScript?"
You can execute JavaScript in the browser using page.evaluate()
Reference: https://playwright.dev/docs/evaluating
await page.evaluate(async () => {
const element = document.getElementById('test');
element.style.display = 'none';
});
I'm confused PW should be used to test an application not drive and alter the web page... How would a user make the element in the application toggle the visibility. Unless your users will actually need to toggle the visibility by executing javascript, seems like the tail wagging the dog...
Can't count how many times i've seen bugs in and app get shipped by doing this...
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].