From c61f7ac590510fdc81bf68b8abdda94c381cf7f1 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Mon, 1 Jul 2024 10:33:32 +0200 Subject: [PATCH] properly wait to fill in the start date --- nzz.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nzz.js b/nzz.js index 4b1475b..fd84830 100755 --- a/nzz.js +++ b/nzz.js @@ -14,9 +14,9 @@ const yargs = require("yargs/yargs"); const { hideBin } = require("yargs/helpers"); const URL = "https://zeitungsarchiv.nzz.ch/"; -const WAIT_TIMEOUT = 3000; +const WAIT_TIMEOUT = 10000; const TIMEOUT_MSG = `Timeout after ${WAIT_TIMEOUT / 1000} seconds.`; -const SEARCH_WAIT_TIMEOUT = 5000; +const SEARCH_WAIT_TIMEOUT = 15000; const SEARCH_TIMEOUT_MSG = `Timeout after ${SEARCH_WAIT_TIMEOUT / 1000} seconds.`; const DOWNLOAD_TIMEOUT = 20000; const USER_AGENT = @@ -85,6 +85,8 @@ async function enterDate(driver, date) { WAIT_TIMEOUT, TIMEOUT_MSG, ); + await driver.wait(until.elementIsVisible(startDate), WAIT_TIMEOUT); + await driver.actions().scroll(0, 0, 0, 0, startDate).perform(); await startDate.clear(); await startDate.sendKeys(dateString);