Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

96
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda