added pagination

main
saif 2025-02-06 10:08:59 +05:00
parent ab47acc4f0
commit 11962a3ff3
1 changed files with 20 additions and 4 deletions

View File

@ -129,10 +129,26 @@ const utils = require("./utils");
// orders array // orders array
let orders_list = []; let orders_list = [];
const pagination = 10; const pagination = 100;
let total_items = 0; let total_items = 0;
let currentPage = 1; let currentPage = 1;
await new Promise((resolve) => setTimeout(resolve, 2_000));
// set the pagination to 100 / page
const pageinationSeletor =
"#orders-tab-list > div.y0DVv7GO > div > div._38NAUUfN > div._15QWqbZs > ul > li.PGT_sizeChanger_123 > div > div > div > div > div";
await page.waitForSelector(pageinationSeletor);
await page.click(pageinationSeletor);
console.log("Clicking on pagination Select");
await new Promise((resolve) => setTimeout(resolve, 3_000));
// select 100 /page option
const pagesPerPageSelector =
"body > div.PT_outerWrapper_123.PP_outerWrapper_123.ST_dropdown_123.ST_mediumDropdown_123.PT_dropdown_123.PT_portalTopLeft_123.PT_inCustom_123.PP_dropdown_123 > div > div > div > div > ul > li:nth-child(5)";
await page.waitForSelector(pagesPerPageSelector);
await page.click(pagesPerPageSelector);
await new Promise((resolve) => setTimeout(resolve, 1_000));
if (orders_list.length === 0) { if (orders_list.length === 0) {
try { try {
// get total items // get total items
@ -354,7 +370,7 @@ const utils = require("./utils");
return; return;
} }
// get orders with 1 item with quantity 1 // get orders with 1 item with quantity 1
console.log( `Item Quantity : ${itemElements.length}`) console.log(`Item Quantity : ${itemElements.length}`);
if (itemElements.length > 1) { if (itemElements.length > 1) {
console.log(`${order} : has more then 1 item`); console.log(`${order} : has more then 1 item`);
return; return;
@ -384,7 +400,7 @@ const utils = require("./utils");
// check quantity should be 1 as well // check quantity should be 1 as well
if (parseInt(quantity) > 1) { if (parseInt(quantity) > 1) {
console.log("Item has more than quantity") console.log("Item has more than quantity");
return; return;
} }