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

Expected to find element: undefined, but never found it when trying to .check() element with no value attribute #7379

Closed
tejasdandekar opened this issue May 16, 2020 · 2 comments · Fixed by #17925
Labels
pkg/driver This is due to an issue in the packages/driver directory type: error message

Comments

@tejasdandekar
Copy link

tejasdandekar commented May 16, 2020

///<reference types="Cypress"/>

describe("checkbox",function(){
    it("checkbox testing",function(){
        cy.visit("https://www.spicejet.com/")
        cy.wait(3000)
        cy.get("input[type='checkbox']:visible").check(["Family and Friends"])
        
})
})
@jennifer-shehane
Copy link
Member

.check() requires being passed the value of the checkbox input, not the text within the label input. The checkboxes on the application under test do not have any value attribute which is why it's unable to check the checkboxes.

This error is not very helpful in this regard however and should probably be better.

index.html

<html lang="en">
<body>
  <input type="checkbox" name="ff">
  <label for="ff">Family</label>
</body>
</html>

spec.js

  it('checkbox testing', function () {
    cy.visit('index.html')
    cy.get('input[type="checkbox"]')
    .check('Family')
  })

@jennifer-shehane jennifer-shehane added type: error message pkg/driver This is due to an issue in the packages/driver directory difficulty: 1️⃣ labels May 18, 2020
@cypress-bot cypress-bot bot added the stage: ready for work The issue is reproducible and in scope label May 18, 2020
@jennifer-shehane jennifer-shehane removed the stage: ready for work The issue is reproducible and in scope label May 18, 2020
@jennifer-shehane jennifer-shehane changed the title AssertionError: Timed out retrying: Expected to find element: undefined, but never found it. at ensureExistence Expected to find element: undefined, but never found it when trying to .check() element with no value attribute May 18, 2020
@jennifer-shehane jennifer-shehane added the stage: ready for work The issue is reproducible and in scope label May 18, 2020
@cypress-bot cypress-bot bot added stage: work in progress stage: needs review The PR code is done & tested, needs review and removed stage: ready for work The issue is reproducible and in scope stage: work in progress labels Aug 27, 2021
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Sep 13, 2021

Released in 8.4.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v8.4.0, please open a new issue.

@cypress-bot cypress-bot bot removed the stage: needs review The PR code is done & tested, needs review label Sep 13, 2021
@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Sep 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pkg/driver This is due to an issue in the packages/driver directory type: error message
Projects
None yet
2 participants