1
0
Fork 0

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.
master
Dustin 2023-07-24 11:15:52 -05:00
parent 805aa40e20
commit 9831fa818f
1 changed files with 5 additions and 0 deletions

View File

@ -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