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

76
Views
Trying to write a Cypress UI test that uses a passed string

I'm attempting to write a Cypress test that uses a string passed through by a different function. The other function simply calls the cypress function and passes a string. This seems to be possible from what I've seen in documentation but I can't figure out what I'm missing. The Cypress test is just supposed to find a button based on it's title, defined by the passed string and click said button.

  When('I click the button ""', function (string) {
    // Clicks a button that test defines by title
    cy.get('button[title=${string}]').click
  });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I see you are using single quote instead of backtick for string interpolation. If it's not a typo you need to correct that

When('I click the button ""', function (string) {
  // Clicks a button that test defines by title
  cy.get(`button[title=${string}]`).click
});
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!