Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

635
Visualizações
Playwright force click on hidden element does not work

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
============================================================
...
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Setting force to true means that you want to bypass the actionability check. It doesn't mean that the click will work.
In this case, if force would have been set to false, the action would have failed due to a timeout, it would have waited for the element to be visible.
With force in true, you don't get a timeout, but the click will fail because you can't click an invisible element.

You might need to find another way to perform the action, javascript maybe?

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda