Convert CSS selectors to XPaths, in JavaScript