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

226
Visualizações
Clicking button in cypress does not have any effect

When cypress clicks the button it seems the click does not have any effect, because clicking manually on the button I see a message confirmation.
This is the HTML code from the button:

enter image description here

the Step definition file:

When("I click Save button",() =>{
    backofficeCreateDeleteClerkPage.saveBtn().click({froce:true})
})

and the js for the button

saveBtn() {
        return cy.get('im-page.hydrated').shadow().find('im-button.hydrated').contains('Save')
        
    }

Any help is appreciated.

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

0

You can directly use the button text Save and use contains for this:

cy.get('im-page.hydrated', {includeShadowDom: true})
  .find('im-button', {includeShadowDom: true})
  .eq(2)
  .find('button', {includeShadowDom: true})
  .click({force: true})

In case you dont want to add {includeShadowDom: true} in your code or repeat it, you can just write it once in your cypress.json and then by default commands like get, find etc will traverse shadow DOM's.

about 4 years ago · Juan Pablo Isaza Relatório

0

Is "force" misspelled here?

backofficeCreateDeleteClerkPage.saveBtn().click({froce:true})

about 4 years ago · Juan Pablo Isaza Relatório

0

You've got multiple shadows. You should be able to find it like this.

cy.find('im-button.hydrated')
  .shadow()
  .contains('Save')
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