diff --git a/sync-fi-invoices.js b/sync-fi-invoices.js index fa2de3e..dafea68 100644 --- a/sync-fi-invoices.js +++ b/sync-fi-invoices.js @@ -52,11 +52,28 @@ const utils = require("./utils"); document.head.appendChild(style); }); + await page.goto("https://www.google.com", { + waitUntil: "domcontentloaded", + timeout: 0 + }); + + // wait for 3 sec + console.log("Waiting 3 sec and taking screenshot"); + await new Promise((resolve) => setTimeout(resolve, 3 * 1000)); + + // take screenshot + let screenshotPath = path.join( + screenshotDirectory, + `${luxon.DateTime.now().toMillis()}.png` + ); + + await page.screenshot({ path: screenshotPath, fullPage: true }); + await page.goto( config[environment].psw_url, { waitUntil: "domcontentloaded", - timeout: 7000 + timeout: 0 }); // wait for 3 sec @@ -64,13 +81,13 @@ const utils = require("./utils"); await new Promise((resolve) => setTimeout(resolve, 3 * 1000)); // take screenshot - let screenshotPath = path.join( + screenshotPath = path.join( screenshotDirectory, `${luxon.DateTime.now().toMillis()}.png` ); await page.screenshot({ path: screenshotPath, fullPage: true }); - await page.waitForSelector("tbody tr.ItemStyle"); + await page.waitForSelector("tbody tr.ItemStyle", { timeout: 30000 }); const data = await page.evaluate(() => { const rows = document.querySelectorAll(