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

294
Visualizações
I cannot submit a form neither using .click() nor using .submit()

In an external webpage that I do not administrate, I have to fill a form that has no id or name. The "submit" button code looks like this:

<button type="submit" class="sui-AtomButton sui-AtomButton--primary sui-AtomButton--solid sui-AtomButton--center">
  <span class="sui-AtomButton-inner">Save</span></button>

At first I tried a simple click like this:

await.page.click('[type="submit"]')

The button was clicked but it did not trigger the submition of the form (I also tried using "Enter" with the keyboard, but the result is the same).

Then, I tried to trigger the submit from the own form like this:

await page.evaluate(() => {
      
 document.forms[0].submit();

})

and like this:

await page.evaluate(() => {
 
 var f = document.forms[0]
 Object.getPrototypeOf(f).submit.call(f);

})

and also like this:

await page.evaluate(() => {
      
 document.forms[0].submit(function(event){
   event.preventDefault();
 });

})

In all the three cases the result is an error in the page.

What should I do? Thanks in advance.

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

0

See that in your JS code you don't have this:

e.preventDefault();

if you have this code then it will prevent the form to be submitted.

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