Skip to content

Instantly share code, notes, and snippets.

@kminardo
Last active May 18, 2017 01:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kminardo/59c591e731c44ccda383499daf948f01 to your computer and use it in GitHub Desktop.
Save kminardo/59c591e731c44ccda383499daf948f01 to your computer and use it in GitHub Desktop.
A simple developer console script to add all the items in an Amazon Wish List to the Amazon Cart.
You will need to allow popups for this script to work, all items will be opened in new tabs.
--------------------------------------------------------------------------------------------------
var elements = document.getElementsByClassName('a-button-text'); // Get all the buttons on the page (Probably overkill)
var filteredEle = []; // Will be used to store the "Add to Cart" buttons
for (let i = 0; i < elements.length; i++) {
if (elements[i].textContent === 'Add to Cart') { // Find the elements that say "Add to Cart"
filteredEle.push(elements[i]); // Put them in their list
}
}
for (let i = 0; i < filteredEle.length; i++) {
window.open(filteredEle[i].href, '_blank'); // Click each button in our list to open in a new window
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment