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

Cypress errors when clicking document().its('body') #27790

Closed
Yihao-G opened this issue Sep 12, 2023 · 5 comments
Closed

Cypress errors when clicking document().its('body') #27790

Yihao-G opened this issue Sep 12, 2023 · 5 comments
Labels
stale no activity on this issue for a long period type: bug

Comments

@Yihao-G
Copy link

Yihao-G commented Sep 12, 2023

Current behavior

When clicking the document.body element, Cypress reports TypeError of options.$el.toArray is not a function:

image

Desired behavior

No response

Test code to reproduce

describe("Test", () => {
  it("should work", () => {
    cy.visit("https://www.google.com");
    cy.document().its("body").click({ force: true });
  });
});

Cypress Version

13.1.0

Node version

16.13.0

Operating System

macOS 13.4.1

Debug Logs

No response

Other

No response

@nagash77
Copy link
Contributor

Hi @Yihao-G is there a reason you don't get the body directly with something like cy.get('body')?

@Yihao-G
Copy link
Author

Yihao-G commented Sep 12, 2023

Hi @nagash77
It's because in my actual code, I need to get the body inside within(() => { ... }). Calling cy.get('body') inside within cannot retrieve the body, so I have to use the workaround of cy.document().its('body')

@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Apr 3, 2024
@cypress-app-bot
Copy link
Collaborator

This issue has been closed due to inactivity.

@cypress-app-bot cypress-app-bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 17, 2024
@RemTopicus
Copy link

As of the current time, with Cypress version 13.17.0, this bug unfortunately still exists.
Can you please reopen this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale no activity on this issue for a long period type: bug
Projects
None yet
Development

No branches or pull requests

5 participants