I'm new to scripting and i'm want to create a script so that it automatically clicks an "Add to Cart" button on the webpage once I visit it
HTML CODE IN THE BUTTON IS
<div id="gb_atc_e0c344b8" class="a-section a-spacing-small a-visible">
<div class="a-button-stack">
<span class="a-button a-spacing-none a-button-primary a-button-icon" id="a-autoid-0">
<span class="a-button-inner">
<i class="a-icon a-icon-cart"/>
<button title="Add to Shopping Cart" class="a-button-text a-text-null" type="button" id="a-autoid-0-announce">Add to Cart</button>
</span>
</span>
</div>
</div>
I've tried using the following script but none of them working If someone could help me create a script that would automatically click the add to cart button I would be extremely grateful
setInterval(function() {
$('.a-text-null').trigger('click');
}, 10);
setInterval(function() {
$("#a-autoid-0-announce").trigger('click');
}, 10);
setInterval(function() {
$('.a-text-null').trigger('click');
}, 10);
setInterval(function() {
$("#a-autoid-0-announce").trigger('click');
}, 10);