From 9831fa818f97b5e4669c350fa92ac52f9bfaa916 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Mon, 24 Jul 2023 11:15:52 -0500 Subject: [PATCH] commerce: Handle interstitial ads Commerce likes to occasionally inject ads and other propaganda after the login page, before loading the account summary page. To handle this, we may need to specifically navigate to the account summary page after logging in. --- xactfetch.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xactfetch.py b/xactfetch.py index be03e88..37747c1 100644 --- a/xactfetch.py +++ b/xactfetch.py @@ -9,6 +9,7 @@ import shlex import shutil import subprocess import tempfile +import urllib.parse from pathlib import Path from types import TracebackType from typing import Any, Optional, Type @@ -396,6 +397,10 @@ class CommerceBank: self.page.get_by_role('button', name='Continue').click() log.debug('Waiting for page load') self.page.wait_for_load_state() + cur_url = urllib.parse.urlparse(self.page.url) + if cur_url.path != '/CBI/Accounts/Summary': + new_url = cur_url._replace(path='/CBI/Accounts/Summary', query='') + self.page.goto(urllib.parse.urlunparse(new_url)) log.info('Successfully logged in to Commerce Bank') self._logged_in = True