I got an error
Hi, I'm working on "Agency Bot for Iphone 16 Pro Max" project where the agency bot is sold for $2000.
I wrote the code for selecting the necessary elements, but I'm getting error ` Waiting for selector `[data-autom='add-to-cart']` failed:
Waiting failed: 30000ms exceeded.
Here is the code ` const puppeteer = require('puppeteer-extra');
const { executablePath } = require('puppeteer');
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
puppeteer.use(StealthPlugin());
const locateChrome = require('chrome-location');
async function givePage() {
const browser = await puppeteer.launch({headless: false, executablePath: locateChrome})
let page = await browser.newPage();
return page
}
async function run() {
let page = await givePage()
await page.goto(url_16)
await add_to_cart(page)
await shipping(page)
}
async function add_to_cart(page) {
smart_click_with_pause(page, "input[data-autom='dimensionScreensize6_3inch']", 0)
smart_click_with_pause(page, "input[value='deserttitanium']", 0)
smart_click_with_pause(page, "input[data-autom='dimensionCapacity256gb']", 0)
smart_click_with_pause(page, "[id='noTradeIn_label']", 0)
smart_click_with_pause(page, "[data-autom='purchaseGroupOptionfullprice_price']", 0)
smart_click_with_pause(page, ".form-selector-title.rf-bfe-dimension-simfree", 0)
smart_click_with_pause(page, "[id='applecareplus_59_noapplecare_label']", 0)
smart_click_with_pause(page, "[data-autom='add-to-cart']", 0)
}
async function smart_click_with_pause(page, selector, pause) {
await page.waitForSelector(selector)
await page.evaluate((s) => document.querySelector(s).click(), selector)
await new Promise(r => setTimeout(r, pause))
}
run()
2
2 comments
Gevorg Hovhannisyan
2
I got an error
Wifi Life
skool.com/wifi-life
A community of developers & entrepreneurs that provides exclusive material to develop coding based side hustles, land high paying tech jobs, and more.
Leaderboard (30-day)
powered by