From 0f9ed86d4962a098e483f4f847b1ccadfbf1370d Mon Sep 17 00:00:00 2001 From: Baruch Odem Date: Wed, 20 Nov 2024 09:24:33 +0200 Subject: [PATCH] fix(mizrahi): update account number selector and add error handling --- src/scrapers/mizrahi.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/scrapers/mizrahi.ts b/src/scrapers/mizrahi.ts index 2f6595ad..a50d6832 100644 --- a/src/scrapers/mizrahi.ts +++ b/src/scrapers/mizrahi.ts @@ -221,9 +221,12 @@ class MizrahiScraper extends BaseScraperWithBrowser await waitUntilElementFound(this.page, `a[href*="${TRANSACTIONS_PAGE}"]`); await this.page.$eval(`a[href*="${TRANSACTIONS_PAGE}"]`, (el) => (el as HTMLElement).click()); - const accountNumberElement = await this.page.$('#dropdownBasic b'); + const accountNumberElement = await this.page.$('#dropdownBasic b span'); const accountNumberHandle = await accountNumberElement?.getProperty('title'); const accountNumber = ((await accountNumberHandle?.jsonValue()) as string); + if (!accountNumber) { + throw new Error('Account number not found'); + } const response = await Promise.any(TRANSACTIONS_REQUEST_URLS.map(async (url) => { const request = await this.page.waitForRequest(url);