Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

99
Views
adding an item to cart with puppetteer on amazon

i started coding this app for scalping on amazon, just to give it a try, im building it with puppeteer and i need to add an item to the cart or just buy it, but it doesn't work on amazon, i tried it on the walmart site and it's perfect.

const puppeteer = require('puppeteer');

const product_url = "https://www.amazon.it/Gigabyte-GeForce-RTX-3060-GAMING/dp/B08WB6R2K4/ref=sr_1_3?__mk_it_IT=%C3%85M%C3%85%C5%BD%C3%95%C3%91&dchild=1&keywords=rtx&qid=1628563186&sr=8-3";



async function givePage(){
    const browser = await puppeteer.launch({headless: false});
    const page = await browser.newPage();
    return page;
}

async function AddToCart(page){
    await page.goto(product_url);
    await page.waitForSelector("button[inputid='add-to-cart-button'")
    await page.click("button[inputid='add-to-cart-button']", elem => elem.click());
    
}

async function checkout(){
    var page = await givePage();
    await AddToCart(page);  
}


checkout();

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

i resolved the problem creating an array with the XPath:

await page.$x('//*[@id="submit.buy-now-announce"]');

then told the program to find the button (for me it was the first you may change it).

    const elements = await page.$x('//*[@id="submit.buy-now-announce"]');
    await elements[0].click() ;

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!