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

251
Views
How to click on a link in web table using cypress for which I am getting message element not visible because it's CSS property is display: none

I have a web table and I have to click on first link which is enabled in 'Action' column. So in this example first two rows does not have link enabled, so I have to click on '8.5 AccountH'

When I inspect this element then following is the HTML for it

enter image description here

I have tried many solutions and some of them are as follow: -

cy.get('.data-table-ctn.mb-3 .data-table div.td').find('span.link').eq(1).click()
OR
cy.get('.data-table-ctn.mb-3 .data-table div.td i.far.check.fa-square').next().click()
OR
cy.get('.data-table-ctn.mb-3 .data-table div.td').find('span.link').eq(1).click({force:true})
OR
cy.get('.data-table-ctn.mb-3 .data-table div.td').find('span.link').first().click()

But none is working. It would be great if community helps me in resolving this.

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

0

You can use force: true it should work.

cy.get('.data-table-ctn.mb-3 .data-table div.td')
  .find('span.link')
  .eq(0)
  .click({force: true})

OR

cy.get('.data-table-ctn.mb-3 .data-table div.td')
  .find('span.link')
  .first()
  .click({force: true})

OR, You can directly use the content and click it, something like:

cy.contains(
  'span.link',
  'AccountHolder Consumer Lending Postgre Move- Prior 3 months data'
).click()
about 4 years ago · Juan Pablo Isaza Report

0

Since events bubble, you can try clicking on the cell and the link should respond.

cy.get('.data-table-ctn.mb-3 .data-table div.td').click()

Select by cell content

Using text in the cell to select is a stronger selector.

cy.contains('.data-table-ctn.mb-3 .data-table div.td', 'Prior 3 months data')
  .click()

Select first enabled row

Using :enabled pseudo selector, there's a few possible options to try

Note: you may have to examine the "row" element to choose a suitable selector - the key thing is to append :enabled to the row selector.

Clicking row

cy.get('.data-table-ctn.mb-3 .data-table')
  .find('.tr:enabled').first()    // first enabled row (not sure what selector to use)
  .click()                        // click the row

Clicking cell

cy.get('.data-table-ctn.mb-3 .data-table')
  .find('.tr:enabled').first()               // first enabled row
  .find('.td.check-td')                      // checkbox cell
  .next()                                   // next cell
  .click()                                  

Clicking span with toggle-group

cy.get('.data-table-ctn.mb-3 .data-table')
  .find('.tr:enabled').first()               // first enabled row
  .find('.td.check-td')                      // checkbox cell
  .next()                                   // next cell
  .find('span.toggle-group')                
  .click({force:true})                      // force because hidden           

Clicking span with description

cy.get('.data-table-ctn.mb-3 .data-table')
  .find('tr:enabled').first()               // first enabled row
  .find('td.check-td')                      // checkbox cell
  .next()                                   // next cell
  .find('span.toggle-group')                
  .next()
  .click()                               

Ref MDN Events

Example diagram:

enter image description here

about 4 years ago · Juan Pablo Isaza Report

0

You can use the :visible selector.

cy.get('.your-link-selector:visible')

If you want it to be more readable with cypress commands you can use .filter()

cy.get('.your-linke-selector')
  .filter(':visible')
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!