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.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user