I encountered an issue with Cypress hover functionality while trying to access a sub menu that appears after hovering over a main menu item. The error message I received was
This element is not visible because it has CSS property: position: fixed and it's being covered by another element:
. Despite following the workarounds suggested by Cypress mentioned in https://docs.cypress.io/api/commands/hover#Workarounds, I did not find success. According to the Cypress documentation, "Using .trigger() will only affect events in JavaScript and will not trigger any effects in CSS", so I attempted to modify the CSS property of the element first before using the .trigger command:
cy.get('.header-module--subMenu--1TF98.header-module--menuLevel2--2QGyh').eq(0).invoke('attr', 'style', 'position: absolute');
cy.get('.header-module--subMenu--1TF98.header-module--menuLevel2--2QGyh').eq(0).should('have.attr', 'style', 'position:
absolute');
cy.get('.header-module--subMenu--1TF98.header-module--menuLevel2--2QGyh').eq(0).invoke('show');
cy.get('.header-module--subMenu--1TF98.header-module--menuLevel2--2QGyh').eq(0).trigger('mouseover');
Unfortunately, this approach did not resolve the issue. Even though the confirmation
expected <ul.header-module--subMenu--1TF98.header-module--menuLevel2--2QGyh> to have attribute style with the value **position: absolute**
was obtained, the same error persisted during the final step This element <ul.header-module--subMenu--1TF98.header-module--menuLevel2--2QGyh> is not visible because it has CSS property: **position: fixed** and it's being covered by another element:
. How can I access the hidden submenu without resorting to using the { force: true }
argument?