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

410
Views
Cypress, haga clic en una imagen enésima en una tabla con src específico

Tengo una lista de elementos en la tabla, cada elemento tiene una imagen, activa (azul) y no activa (negra), ¿cómo hago esta consulta para ciprés?

Esta es la imagen de la lista de tablas: ingrese la descripción de la imagen aquí

Entonces este es el código html para la tabla: ingrese la descripción de la imagen aquí

Cuando se expande, la imagen está debajo, tiene una ruta src de /static/images/icon_profile.png ingrese la descripción de la imagen aquí

Mi prueba actual es así:

 it('Should create a legal form of a Customer profile', ()=>{ cy.get('th').eq(50).find('img').should('have.attr', 'src', '/static/images/icon_profile.png').first().click() })

Pero cuando lo ejecuto me sale este error:

ingrese la descripción de la imagen aquí

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Puedes hacerlo más fácilmente combinando selectores

 cy.get('tr img[src="/static/images/icon_profile.png"]') .first() .parent('a') // click the link not the img .click()

Para confirmar que tiene el índice correcto cuando usa .eq(50) ejecute

 cy.get('tr img[src="/static/images/icon_profile.png"]') .first() .parent('tr') .invoke('index') // which row is it? .log()
about 4 years ago · Juan Pablo Isaza Report

0

puedes hacer algo como esto

 cy.get('tr').each(($ele) => { if ($ele.attr('src') == '/static/images/icon_profile.png') { cy.wrap($ele).parent('a').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!