Skip to content

Instantly share code, notes, and snippets.

@mindeng
Last active December 3, 2018 08:38
Show Gist options
  • Select an option

  • Save mindeng/07295dee5a1fa0fdc7bfc4680d16518a to your computer and use it in GitHub Desktop.

Select an option

Save mindeng/07295dee5a1fa0fdc7bfc4680d16518a to your computer and use it in GitHub Desktop.
extract urls from web page (you can run it from chrome console or code snippets)
// xpath of items
var jd_items_in_cart = '//*/div[1]/div[2]/div/div[2]/div[1]/a';
var items = document.evaluate(jd_items_in_cart, document, null, XPathResult.ANY_TYPE, null);
while(item=items.iterateNext()) {
console.log(item.href);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment