I am using Playwright for end to end testing. One of the scenario involves checking the content of a pdf displayed in a PDFviewer window, for which download button have been hidden for the end user. Checking the pdf content involves downloading it, thus I used
the force
option mentionned by Playwright documentation :
https://playwright.dev/docs/api/class-page#page-click
The implementation used is the following :
innerFrameContent.click("//button[contains(@id, 'secondaryDownload')]", { force: true })
(the xpath is correct, I checked within Chrome browser and managed to click on the element through the console )
Unfortunatly, I get the following exception log from Playwright :
frame.click: Element is not visible
=========================== logs ===========================
waiting for selector "//button[contains(@id, 'secondaryDownload')]"
selector resolved to hidden <button tabindex="54" title="Download" id="secondaryDown…>…</button>
attempting click action
waiting for element to be visible, enabled and stable
forcing action
element is visible, enabled and stable
scrolling into view if needed
============================================================
...