mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-11 17:50:01 -06:00
1.0 KiB
1.0 KiB
title, comments
| title | comments |
|---|---|
| Cypress.$ | false |
Cypress automatically includes {% url 'jQuery' http://jquery.com %} 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 {% url cy.visit() visit %}.
This is a great way to synchronously query for elements when debugging from Developer Tools.
Syntax
Cypress.$(selector)
// other proxied jQuery methods
Cypress.$.Event
Cypress.$.Deferred
Cypress.$.ajax
Cypress.$.get
Cypress.$.getJSON
Cypress.$.getScript
Cypress.$.post
Usage
{% fa fa-check-circle green %} Correct Usage
Cypress.$('p')
{% fa fa-exclamation-triangle red %} Incorrect Usage
cy.$('p') // Errors, cannot be chained off 'cy'
Examples
Selector
var $li = Cypress.$("ul li:first")
cy.wrap($li)
.should("not.have.class", "active")
.click()
.should("have.class", "active")