OnetapInc / chromy

Chromy is a library for operating headless chrome. 🍺🍺🍺
MIT License
605 stars 41 forks source link

Attribute selectors #60

Closed lancetharper closed 6 years ago

lancetharper commented 6 years ago

Testing the beta version of backstopjs and noticed that attribute selectors don't work (but they did with phantom).

Error: An error has occurred evaluating the script in the browser.SyntaxError: Unexpected identifier

works: selectors: [ '.test' ]

doesn't work: selectors: [ "[data-backstop='test']" ]

Hopefully it's an easy fix! Thanks!

garris commented 6 years ago

@lancetharper Does this work if you escape the inner quotes? e.g. "[data-backstop=\'test\']" or "[data-backstop=\"test\"]"

garris commented 6 years ago

@lancetharper thanks for posting to chromy -- but it's actually a backstop issue. Can you let me know if using the escape works? If so -- I will make backstop work the same as with casper in this case. Please let me know. thanks!

lancetharper commented 6 years ago

@garris I tried "[data-backstop=\"test\"]" which my linter changed to '[data-backstop="test"]' and that worked for me.

garris commented 6 years ago

@lancetharper Great! thanks for verifying. I will add explicit escaping in BackstopJS soon to make the issue go away in all cases. Cheers.