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

148
Views
No se puede hacer clic en un botón usando titiritero

Estoy tratando de recorrer una matriz para buscar y agregar varios artículos en el carrito en https://www.woolworths.com.au/shop/search/ Sin embargo, después de la búsqueda, el botón Agregar al carrito simplemente no funciona desde Titiritero. He intentado varias formas, como usar xpath, texto, nombre de clase y ninguna de ellas parece funcionar.

 const [button] = await page.$x("//button[contains(., ' Add to cart ')]"); if (button) { await button.click(); } const buttons = await page.$$('button[class*="cartControls-addButton"]') .then(()=>console.log("got buttons")) console.log(buttons); await buttons[i].click(); let button = await page.$x('//*[@id="search-content"]/div/wow-product-search-container/shared-grid/div/div[1]/shared-product-tile/section/footer/div/shared-cart-controls/div/shared-cart-buttons/div/div/div/div/button/span') console.log(button); const linkHandlers = await page.$x("//a[contains(text(), ' Add to cart ')]"); if (linkHandlers.length > 0) { await linkHandlers[0].click(); } else { throw new Error("Link not found"); }

¿Puedes decirme cuál es mi problema? También tengo todo mi código en este repositorio .

about 4 years ago · Juan Pablo Isaza
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!