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.

Revisions

  1. mindeng revised this gist Dec 3, 2018. No changes.
  2. mindeng created this gist Dec 3, 2018.
    6 changes: 6 additions & 0 deletions extract-urls.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    // 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);
    }