Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

234
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

0

Is "force" misspelled here?

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

about 4 years ago · Juan Pablo Isaza Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda