This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //import puppeteer | |
| import puppeteer from 'puppeteer'; | |
| async function muiSelectOption(page, buttonSelector, optionValue) { | |
| let liComponent; | |
| let selectorSubstr = buttonSelector.substring(1); // Remove the leading '#' or '.' | |
| if (optionValue) { | |
| liComponent = `li[data-value="${optionValue}"]`; | |
| } else { | |
| liComponent = 'li:first-child'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const puppeteer = require('puppeteer'); | |
| async function fillForm(data) { | |
| const browser = await puppeteer.launch({ headless: true }); | |
| const page = await browser.newPage(); | |
| for (const item of data) { | |
| await page.goto('YOUR_WEBPAGE_URL'); // Replace with your webpage URL | |
| // Click the first "Select" button |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //import puppeteer | |
| import puppeteer from 'puppeteer'; | |
| async function muiSelectOption(page, buttonSelector, optionValue) { | |
| let liComponent; | |
| let selectorSubstr = buttonSelector.substring(1); // Remove the leading '#' or '.' | |
| if (optionValue) { | |
| liComponent = `li[data-value="${optionValue}"]`; | |
| } else { | |
| liComponent = 'li:first-child'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { NextResponse } from "next/server"; | |
| import { getLowestPrice, getHighestPrice, getAveragePrice, getEmailNotifType } from "@/lib/utils"; | |
| import { connectToDB } from "@/lib/mongoose"; | |
| import Product from "@/lib/models/product.model"; | |
| import { scrapeAmazonProduct } from "@/lib/scraper"; | |
| import { generateEmailBody, sendEmail } from "@/lib/nodemailer"; | |
| export const maxDuration = 300; // This function can run for a maximum of 300 seconds | |
| export const dynamic = "force-dynamic"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { NextResponse } from "next/server"; | |
| import { getLowestPrice, getHighestPrice, getAveragePrice, getEmailNotifType } from "@/lib/utils"; | |
| import { connectToDB } from "@/lib/mongoose"; | |
| import Product from "@/lib/models/product.model"; | |
| import { scrapeAmazonProduct } from "@/lib/scraper"; | |
| import { generateEmailBody, sendEmail } from "@/lib/nodemailer"; | |
| export const maxDuration = 300; // This function can run for a maximum of 300 seconds | |
| export const dynamic = "force-dynamic"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {/* Download button */} | |
| <button className='download-btn' onClick={downloadCanvasToImage}> | |
| <img | |
| src={download} | |
| alt='download_image' | |
| className='w-3/5 h-3/5 object-contain' | |
| /> | |
| </button> |