It seems like they're identical. Is there ever any difference in output between cy.get("a").find("b") and cy.get("a b")?
(Where a and b are some selectors, e.g. div and span, or .someClass and .someOtherClass.)
As you stated in your question there is not difference between cy.get("a").find("b") and cy.get("a b"). But the most important difference between find and get commands in Cypress is that cy.get() is chained off of cy, it always looks for the selector within the entire document as stated in Cypress documents. But as again stated in Cypress documents find works as follows:
Get the descendent DOM elements of a specific selector.
So the command cy.get("a").find("b") returns all the b elements which are successor of an a element, but cy.get("a").get("b") finds all the a and b elements regardless of they are parent and child.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With