cy.url() and/or cy.location('href') does not return a string as documentation claims
See original GitHub issueCurrent behavior:
According to the documentation, Cy.url() should produce a string. I wanted to capture the current URL into a variable and then reference it after I run a custom Cypress command.
My question is, if cy.url() and cy.location(‘href’) no longer return strings in 3.0.1
- how do we get that value?
Desired behavior:
Expecting a string of the current URL; instead an object is received that looks like:
// JSON.stringify(cy.url())
{ "chainerId": "chainer2504", "firstCall": false }
// JSON.stringify(cy.location('href'))
{ "chainerId": "chainer2558", "firstCall": false }
Steps to reproduce:
Attempting to log either cy.url()
or cy.location('href')
does not result in a string as indicated by the documentation.
Versions
Cypress 3.0.1
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:9 (3 by maintainers)
Top Results From Across the Web
cy.url() and/or cy.location('href') does not return a string
Commands are enqueued and run asynchronously. The solution is shown too: To access what each Cypress command yields you use .then() . cy....
Read more >url - Cypress Documentation
cy.url() exists because it's what most developers naturally assume would return them the full current URL. We almost never refer to the URL...
Read more >Location | Cypress examples (v9.7.0) - Gleb Bahmutov
To get the current URL hash, use the cy.hash() command. ... cy.location().should((location) => { // returns an object with every part of the...
Read more >How to Test that URL Should Not Include a String in Cypress
If you want to verify that your URL should not include a string in ... cy.url().should('not.contain', '/home'); // You can also use a...
Read more >LTX2X: A L ATEX to X Auto-tagger Contents - CTAN
In the command table bye.ct these are only included to. prevent printing before the \begin{document}. To run LTX2X with the above command table, ......
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
@brian-mann Then you should update your documentation and stop claiming that
url()
returns a string?// if you need the current url in order to store it and use it later, you may do that:
// and then use it later like that