Chase made some minor updates to their site recently which affected some
of the element locators. The propaganda in the right-hand column of the
landing page has changed, and the Downlod Account Activity form is still
really terrible, and now behaves even more strangely.
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.
The Commerce Bank website no longer allows navigating directly to
`Download.ashx`; doing so just returns a generic "we're sorry" error.
They appear to have added some CSRF protection or something that makes
this not work. As a result, we have to go fill out the form on the
*Download Transactions* modal dialog in order to get the download to
work correctly.
In order to set the message for a notification with an attachment, the
text must be specified in the `Message` request header. Unfortunately,
HTTP header values are limited to the Latin-1 character set, so Unicode
characters cannot be included. As of *ntfy* 2.4.0, however, the server
can decode base64-encoded headers using the RFC 2047 scheme.
To maintain compatibility with older *ntfy* servers, the `ntfy` function
will only encode message contents this way if the string cannoto be
encoded as ASCII.
When there are multiple accounts associated with a Chase online banking
user, the dashboard page layout changes. Detailed account history is no
longer shown, so the elements we were waiting for in the "Waiting for
page to load completely" step never appear. Since we're navigating
directly to the download account transactions page now, anyway, we do
not even need to wait for this button to appear.
Although it is undocumented, *ntfy* accepts a `Message` header along
with a file upload, which sets the message content of the notification
when a file is attached. Since HTTP headers cannot contain multiple
lines, the newline character has to be escaped. The *ntfy* server
performs unescaping automatically.
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.
The `ntfyerror` context manager replaces `screenshot_failure` for
handling online banking interaction failures. It has several
advantages, notably:
* takes a screenshot of the browser page *before* logging out
* cleaner suppression of exceptions, with success tracking
* sends an `ntfy` message, with the screenshot attached