Skip to content

Commit

Permalink
fixed amex
Browse files Browse the repository at this point in the history
  • Loading branch information
ga128k committed Feb 15, 2024
1 parent fbd53fe commit 1bfc154
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions amex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,14 @@ export async function fetchTransactions(): Promise<Account[]> {
try {
const buttonGroupSelector =
".one-identity-two-step-verification__style__buttonGroup___Lt-DI";
await page.waitForSelector(buttonGroupSelector);
await page.waitForSelector(buttonGroupSelector, { timeout: 10000 });
await page.click(`${buttonGroupSelector} button`);
await page.setJavaScriptEnabled(false);
} catch (e) {
console.error(e);
console.log("Reloading page....");
await page.setJavaScriptEnabled(false);
await page.reload();
await page.goto("https://global.americanexpress.com/dashboard");
}

let headers = {};
Expand All @@ -292,8 +293,14 @@ export async function fetchTransactions(): Promise<Account[]> {
};
page.on("response", responseHandler);

await page.waitForNavigation({ waitUntil: "domcontentloaded" });

try {
await page.waitForNavigation({
waitUntil: "domcontentloaded",
timeout: 15000,
});
} catch (e) {
console.error(e);
}
html = await page.content();
accounts = getAccounts(html);

Expand Down

0 comments on commit 1bfc154

Please sign in to comment.