// ==UserScript== // @name Amazon Add to Cart // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match *://www.amazon.in/*/dp/* // @match *://www.amazon.in/dp/* // @match *://www.amazon.in/gp/product* // @grant none // ==/UserScript== /* jshint -W097 */ 'use strict'; // Your code here... var buyNowButton = document.querySelector('#buy-now-button'); var addToCardButton = document.querySelector('#add-to-cart-button') if (addToCardButton) { addToCardButton.click(); console.log('clicking add to cart button'); } else if (buyNowButton) { buyNowButton.click() console.log('clicking buy now button'); } else { location.reload(); }