-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cy.get
does not work with IDs that use characters other than [0-9a-zA-Z\-]+
#2027
Comments
Yes, this is a bug. The ID above is fine as defined in spec: https://www.w3.org/TR/html50/dom.html#the-id-attribute This error is being thrown from Sizzle, and likely was fixed in a later version of jQuery, but we are on an earlier version - version 2.2.4. Pull request to update jQuery: #1229 |
Can we get an update on the progress of this. It's been parked for a while |
No work has been done for this - jQuery PR is open if anyone wants to help contribute. It's a big update. |
Hey there! haven't seen any updates in this in a while, mind if I ask what's the status of the fix? |
Hi All, Also have the error in this case .get( Error: Error: Syntax error, unrecognized expression: [aria-label=Jun 2, 2019] Any workaround to continue as of now ? Regards, |
Can you put the selector in quotes?
…Sent from my iPhone
On May 28, 2019, at 13:12, Ravi Kiran R ***@***.***> wrote:
Hi All,
Also have the error in this case .get([aria-label=Jun 2, 2019])
Error: Error: Syntax error, unrecognized expression: [aria-label=Jun 2, 2019]
Regards,
Ravi
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Its like this, what I'm trying.. .get(`[aria-label=${getDateVar}]`) and ${getDateVar} is Jun 2, 2019 |
I think it should be quoted like a JavaScript string and then as an
attribute selector because it has spaces
.get(`[aria-label="${dateVar}"]`)
…On Tue, May 28, 2019 at 2:16 PM Ravi Kiran R ***@***.***> wrote:
Can you put the selector in quotes?
… <#m_-7156384978626998545_>
Its like this, what I'm trying..
.get([aria-label=${dateVar}])
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2027?email_source=notifications&email_token=AAQ4BJUN4RWP4KG2RARSO6DPXUPALA5CNFSM4FG2O47KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWL5X5A#issuecomment-496491508>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAQ4BJQMANUXN2PSLYC73W3PXUPALANCNFSM4FG2O47A>
.
--
Dr. Gleb Bahmutov, PhD
Schedule video chat / phone call / meeting with me via
https://calendly.com/bahmutov
gleb.bahmutov@gmail.com @bahmutov <https://twitter.com/@bahmutov>
https://glebbahmutov.com/ https://glebbahmutov.com/blog
https://github.com/bahmutov
|
Ok sure, would give a try with quotes. And it works, thanks a lot for the reply. |
Same problem here with using the
Does anyone have an idea how to maybe work around this until the issue is fixed? Removing the |
I also face the same issue with the following code. Getting error message that "Error: Syntax error, unrecognized expression: [data-org-ta=navigation.news]" |
Also
I am using Vue.js to bind in my app like:
|
Any updates on this? |
Also failing here.. :( |
I had the same issue using a dot
Seems to be working when double escaped:
|
I opened an issue at jquery/sizzle#465. It's not solved in jquery@3.4.1 yet. |
This is not a bug. When used in a selector, IDs, classes etc. need to be escaped when they contain some special characters. There's a standard |
The code should be written in this way: <!doctype html>
<html lang="en">
<body>
<div id="Configuration/Setup/TextField.id">Hello World</div>
</body>
</html> it('test', () => {
cy.visit('fixtures/issue-2027.html')
cy.get(`#${CSS.escape('Configuration/Setup/TextField.id')}`)
.contains('Hello World')
}) This issue is solved thanks to @mgol. But we have a few things to decide/do. 1. We should add this to FAQ of the doc. Right? cy.get(`#${cy.$$.escapeSelector('Configuration/Setup/TextField.id')}`)
.contains('Hello World') Maybe we need a new API page for |
Things cannot change just because a spec is a Working Draft. This particular API has been implemented by all still developed browser engines for a long time (Edge was an exception but the old engine is dead now) so changing it right now in a meaningful way is very likely not Web-compatible. |
The code for this is done in cypress-io/cypress#6327, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior:
Running something like
cy.get('#Configuration/Setup/TextField.id')
yields an error despite being a valid HTML5 ID. Per spec, HTML5 IDsInstead, when using an ID with characters like
/
or.
, an error gets thrown:Desired behavior:
IDs with valid characters such as
/
or.
should work.Steps to reproduce:
Write a spec that accesses an ID formatted as described above, for example:
cy.get('#Configuration/Setup/TextField.id')
.Versions
Cypress 3.0.1
Chrome Version 67.0.3396.87 (Official Build) (64-bit)
Windows 10 64bit
The text was updated successfully, but these errors were encountered: