Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS property: display: none, web element not found by CYP #29369

Open
GeorgeBeres opened this issue Apr 19, 2024 · 1 comment
Open

CSS property: display: none, web element not found by CYP #29369

GeorgeBeres opened this issue Apr 19, 2024 · 1 comment
Labels
stage: needs information Not enough info to reproduce the issue

Comments

@GeorgeBeres
Copy link

GeorgeBeres commented Apr 19, 2024

Current behavior

Hi I do have the same issue when I'm trying to use a loop to go through a list of product in a table view by table row, how can I solve this issue? It adds the first product in the basket but when the loop iterates again then I get the same error as above saying that the locator I have provided CSS property: display: none.

Also if I use click({ force: true }) then still adds only one product to my basket but finds the rest of the products which meet my if condition... again this is not the solution.

Desired behavior

I would like that Cypress to add products to my basket on this eCommerce website.

Test code to reproduce

it('searches for a product and adds it to the basket', () => {
      cy.get('#search-box').type('cookie')
      cy.get('#search-button').click()
      cy.wait(2000)

cy.get('.productList-block').find('tbody tr').each(($el, index, $list) => {
const productText = $el.find('.productName').text()
if(productText.includes('Cookie')) {
cy.wrap(productText).get('.list-buttons').contains('Add').click({ force: true })

       }
 })

})

Cypress Version

13.7.1

Node version

v20.11.1

Operating System

macOS 14.2.1 (23C71)

Debug Logs

none

Other

No response

@jennifer-shehane
Copy link
Member

We'll need a reproducible example to assist. Also, check out our community chat, it can be helpful for debugging or answering questions on how to use Cypress.

@jennifer-shehane jennifer-shehane added the stage: needs information Not enough info to reproduce the issue label Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage: needs information Not enough info to reproduce the issue
Projects
None yet
Development

No branches or pull requests

2 participants