mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-18 22:28:38 -05:00
1.0 KiB
1.0 KiB
title: cypress-jquery comments: true
Cypress.$( selector )
Cypress automatically proxies jQuery and exposes it as Cypress.$
Calling Cypress.$("button") will automatically query for elements in your remote window. In other words, Cypress automatically sets the document to be whatever you've currently navigated to via cy.visit.
This is a great way to synchronously query for elements when debugging from Chrome Dev Tools.
Other proxied jQuery methods
Cypress.$.EventCypress.$.DeferredCypress.$.ajaxCypress.$.getCypress.$.getJSONCypress.$.getScriptCypress.$.post
{% note info %}
If you're looking to make an XHR request in your test scripts, use cy.request
{% endnote %}
Selector Usage
var $li = Cypress.$("ul li:first")
cy
.wrap($li)
.should("not.have.class", "active")
.click()
.should("have.class", "active")