From 58f417aea9e925eee52108fce6e790d0a0b35b01 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Thu, 11 May 2023 22:55:42 -0500 Subject: [PATCH] chase: Go directly to the download page When there are no transactions in the default display, the *Download account activity* button is disabled. To avoid failing in this case, we now navigate directly to the download page. This requires explicitly selecting the credit card account from the dropdown list, as it is not pre-filled when the page is loaded directly. --- xactfetch.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/xactfetch.py b/xactfetch.py index 824ea89..ec32b7d 100644 --- a/xactfetch.py +++ b/xactfetch.py @@ -551,15 +551,14 @@ class Chase: log.debug('Waiting for page to load completely') self.page.get_by_role('link', name='Sort Options').wait_for() self.page.wait_for_timeout(random.randint(1500, 2500)) - s = self.page.locator('#downloadActivityIcon') - s.wait_for() - self.page.wait_for_timeout(random.randint(1500, 2500)) - log.debug('Clicking "Download account activity" button') - s.click() + href = '#/dashboard/accountDetails/downloadAccountTransactions/index' + self.page.evaluate(f'window.location.href = "{href}";') log.debug('Waiting for page to load') s = self.page.locator('button#select-downloadActivityOptionId') s.wait_for() log.debug('Filling account activity download form') + self.page.locator('button#select-account-selector').click() + self.page.get_by_text('CREDIT CARD').nth(1).locator('../..').click() s.click() self.page.get_by_text('Choose a date range').nth(1).locator( '../..' @@ -575,7 +574,7 @@ class Chase: ) self.page.locator('#accountActivityToDate-input-input').blur() self.page.wait_for_timeout(random.randint(500, 1500)) - with self.page.expect_download() as di: + with self.page.expect_download(timeout=5000) as di: self.page.get_by_role( 'button', name='Download', exact=True ).click()