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

346
Visualizações
File chooser dialog can only be shown with a user activation error while using web scraping through Javascript

I am trying to programmatically click a button in a web page using the command

document.getElementsByName("versionFile")[0].click()

while this command works fine in the developer tool console (opens the file selector) i am not able to execute this in script because it gives me a error saying "File chooser dialog can only be shown with a user activation" highlighting the click() function

Can anyone hep me out with this.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Most modern browsers restrict the JavaScript interactions not started by the user, to avoid annoying pages and make XSS a bit more difficult.

If you are using a web-scraping library like puppeteer, you should interact with the page using it's API (using page.click for example), not by injecting JavaScript on the page.

If that is not a option, you need to find the callback function that the button fires, and bypass the element.click() method.

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