Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't click on an element that is overlapped by another element using (sypress framework)

Tags:

cypress

I want to click on the element

        cy.visit('https://test.com:1111/')        
        cy.get('button').click()
        cy.contains('Configuration').click()
        cy.get('ant-tabs-tab').contains('Blocks').click()

but this element is overlapped by another element with CypressError:

Timed out retrying: cy.click() failed because this element:
  <div role="tab" aria-disabled="false" aria-selected="false" class=" ant-tabs-tab"> Blocks </div>
is being covered by another element:
  <ul class="ant-menu menu ant-menu-dark ant-menu-root ant-menu-horizontal" role="menu" style="line-height: 64px;">...</ul>
Fix this problem, or use {force: true} to disable error checking.
like image 427
Александр Avatar asked Dec 31 '25 08:12

Александр


1 Answers

You can use {force: true} with click() to disable error checks:

cy.visit('https://test.com:1111/')
cy.get('button').click({force: true})
cy.contains('Configuration').click({force: true})
cy.get('ant-tabs-tab').contains('Blocks').click({force: true})
like image 136
Alapan Das Avatar answered Jan 07 '26 07:01

Alapan Das



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!