Reputation: 395
I am getting below error when performing action on a element in a iframe:
"Timed out retrying after 60000ms: expected '
' to be 'visible' This element
is not visible because it has an effective width and height of: 0 x 0 pixels."
Here is my code for the element:
cy.get('iframeselector',{timeout: 150000})
.its('0.contentDocument.body').should('not.be.empty')
.then(cy.wrap).find('p').should('be.visible').clear().type('abc')
I have tried using {force:true} and even changing the width by invoke method. but nothing works for me so far. Any help will be appreciated.
Upvotes: 2
Views: 6275
Reputation: 395
I got the solution. There are 3 other iframes in the page and each iframe is inside a container. I intended to perform action on element insode the 2nd iframe and by default my code was trying to work on element in 1st iframe.
Cyress did not give the error about multiple iframes being found found. So it threw me off with the 0x0 pixel error. Following worked for me:
cy.get('parentContainer').within(()=>{
cy.get('iframeselector',{timeout: 150000})
.its('0.contentDocument.body').should('not.be.empty')
.then(cy.wrap).find('p').should('be.visible').clear().type('abc')
})
Upvotes: 1