Getting errors using cy.get(...).contains(...).click()
See original GitHub issueCurrent behavior
Currently, when running a test in headless mode, doing cy.get('element').contains('something').click()
will be completed successfully, however will show up as an error:
and throw the following error along the way:
2021-08-25 19:27:57.384 Cypress Helper[66690:816470] In -[NSApplication(NSQuietSafeQuit) _updateCanQuitQuietlyAndSafely], _LSSetApplicationInformationItem(NSCanQuitQuietlyAndSafely) returned error -50
The issue here for us is it might seem like a flaky test, but it is actually not.
Desired behavior
In this situation, Cypress shouldn’t throw an error.
Test code to reproduce
cy.get('element').contains('something').click()
Cypress Version
8.3.1
Other
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Error Messages | Cypress Documentation
Getting this error means you've tried to interact with a "dead" DOM element - meaning the current subject has been removed from the...
Read more >Using Cypress cy.get() with a contains selector not working as ...
cy.get('body:contains(ATHLETE FIRST NAME)').click() will return the body element which is a single element so there will be no error.
Read more >Misleading error message when trying to access ... - GitHub
Some of our tests sometimes showed the following error message: cy.contains() failed because it requires the subject be a global window object ....
Read more >8 common mistakes in Cypress (and how to avoid them)
Remember, .should() command will make the previous command retry, but not the full chain. This means that our cy.get('[data-cy= ...
Read more >`cy.click()` failed because this element is detached from the dom
Below is the error code that I am getting while I am trying to automate user creation scenario ... When you invoke cy.get(),...
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
@yonatanaftali try reading the retry-ability guide linked above and use a single
cy.contains
command instead of cy.get+ cy.contains combinationAs another precaution I would add
For any more help, please provide the app we can run to see the problem.
@bahmutov I followed your suggestion and it solved our issue. Thanks! Much appreciated!