TypeError: remoteJQuery is not a function
See original GitHub issueCurrent behavior:
cy.get(selector)
works fine.
cy.get(selector).then((elem) => {})
with any callback results in TypeError: remoteJQuery
, with no extra information
Desired behavior:
cy.get(selector).then((elem) => {}) should give me access to the element.
Test code:
it('example', () => {
cy.get('#cy-div')
.then(elem => {
elem;
})
})
I’ve tried cy v2.0.4 and v2.1
on Mac OS 10.13.3 using chrome.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:13 (2 by maintainers)
Top Results From Across the Web
Cypress: TypeError window.parent.$ is not a function
The message about window.parent.$ sounds like you are testing a login form that is usually embedded in an iframe.
Read more >cypress-io/cypress - Gitter
Tried to break it down - getting error: THEN function(){} ... Its mad about: Error: TypeError: $els[0].forEach is not a function. Florian Goussin....
Read more >Uncaught TypeError | Is Not A Function | Solution - YouTube
Have you encountered an error like:- Uncaught TypeError - Some selector is not a function - jQuery is not a function - owlCarousel...
Read more >JavaScript / DHTML Blog Posts by Ben Nadel
Ben Nadel's complete list of blog entries about JavaScript / DHTML.
Read more >validator $.validator.methods[method] is undefined
I have this validator form code I have inherited which I am getting this error: $.validator.methods[method] is undefined.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We were in the similar situation, where our website made use of window.$ as something than jQuery.
To give you a surprise, this is what we have:
It really made us worried initially that we would have to change all the occurrences of
$(...)
to something else in order to make the Cypress work, but luckily, after gloating inside the cypress source code, we found something that could work for us & guess what, it did.We hope that this could help others too 😃
@marioparris-qless I think I fixed it with the following code:
For anyone else having the same problem, what the code does is, before loading every page in the spec, check if the Window object has the jQuery or $ properties, and if not, assign the jQuery that comes with Cypress to Window.$. As script tags are loaded after this, if the page uses a jQuery library, that one will override the one we set, so the page will still work and we can use jQuery from Cypress.