The Wayback Machine - https://web.archive.org/web/20201130045414/https://github.com/checkly/headless-recorder/issues/110
Skip to content
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

Wrong espcaping of special characters in selector #110

Open
olejorgenb opened this issue Oct 16, 2020 · 3 comments
Open

Wrong espcaping of special characters in selector #110

olejorgenb opened this issue Oct 16, 2020 · 3 comments

Comments

@olejorgenb
Copy link

@olejorgenb olejorgenb commented Oct 16, 2020

The following was generated by headless-recorder

await page.waitForSelector('body > #app > .Connect\(Layout\)-root-1 > .Connect\(Layout\)-content-2 > .Dashboard-container-45')

But since \ already means escape next char in javascript the \ also need escaping:

await page.waitForSelector('body > #app > .Connect\\(Layout\\)-root-1 > .Connect\\(Layout\\)-content-2 > .Dashboard-container-45')
@maxigimenez
Copy link
Collaborator

@maxigimenez maxigimenez commented Oct 17, 2020

Hi @olejorgenb, thanks for flagging this. Can you provide a website where we can reproduce the issue?

@olejorgenb
Copy link
Author

@olejorgenb olejorgenb commented Oct 17, 2020

No, the site is not public, but I would guess it's easy enough to reproduce using a class name containing an escaped (: I don't have the extension handy but maybe this will do the trick: https://jsfiddle.net/Laqbnx58/1/

There's no escaping of the \s in the selector here:

block.addLine({ type: domEvents.CLICK, value: `await ${this._frame}.waitForSelector('${selector}')` })

CSS class names are allowed to contain \ escaped special characters: https://www.w3.org/TR/CSS21/syndata.html#characters

The class names are generated by material UI's JSS. The react-redux Connect HOC add brackets to the component name which JSS use as a basis for making the class name. Of course - using these class names are not really robust, so a proper test wouldn't really rely on these.

@maxigimenez maxigimenez removed the question label Oct 18, 2020
@maxigimenez
Copy link
Collaborator

@maxigimenez maxigimenez commented Oct 19, 2020

Thanks for the information @olejorgenb. I would gladly take a PR for it! Otherwise, I'm going to keep an eye on it and fix it when we have the bandwidth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
@olejorgenb @maxigimenez and others
You can’t perform that action at this time.