matthewmueller / x-ray

The next web scraper. See through the <html> noise.
MIT License
5.88k stars 349 forks source link

Starts with attribute selector doesn't work: [attribute^=value] #210

Open cuzzo opened 8 years ago

cuzzo commented 8 years ago

Subject of the issue

I don't appear able to select attributes using the starts with selector: [attribute^="value"]. I'm able to select the elements just fine if I use a much more brittle selector, so it doesn't appear to be an issue with the request.

Your environment

node version: v4.2.6 npm version: 3.5.2

Steps to reproduce

var x = require("x-ray")(); x( "https://www.goodreads.com/work/shelves/21500681", { genres: "[href^=\"/genres\"]" } ) .limit(1) .write("genres.json");

Expected behaviour

I would exepct to get a list of all genres on the page, similar to the results of this selector: [".shelfStat a"]

Actual behaviour

I get an empty array.