properly wait to fill in the start date

This commit is contained in:
Sebastian Hugentobler 2024-07-01 10:33:32 +02:00
parent aab411fcca
commit c61f7ac590
Signed by: shu
GPG Key ID: BB32CF3CA052C2F0

6
nzz.js
View File

@ -14,9 +14,9 @@ const yargs = require("yargs/yargs");
const { hideBin } = require("yargs/helpers"); const { hideBin } = require("yargs/helpers");
const URL = "https://zeitungsarchiv.nzz.ch/"; const URL = "https://zeitungsarchiv.nzz.ch/";
const WAIT_TIMEOUT = 3000; const WAIT_TIMEOUT = 10000;
const TIMEOUT_MSG = `Timeout after ${WAIT_TIMEOUT / 1000} seconds.`; 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 SEARCH_TIMEOUT_MSG = `Timeout after ${SEARCH_WAIT_TIMEOUT / 1000} seconds.`;
const DOWNLOAD_TIMEOUT = 20000; const DOWNLOAD_TIMEOUT = 20000;
const USER_AGENT = const USER_AGENT =
@ -85,6 +85,8 @@ async function enterDate(driver, date) {
WAIT_TIMEOUT, WAIT_TIMEOUT,
TIMEOUT_MSG, 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.clear();
await startDate.sendKeys(dateString); await startDate.sendKeys(dateString);