Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

230
Views
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 answers
Answer question

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 Report

0

Is "force" misspelled here?

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

about 4 years ago · Juan Pablo Isaza Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!