I am working on a bot that should be simple, but one part of it is giving me fits. The bot goes out to a public bank site like Chase.com, and downloads the Deposit Account Agreement. I have no problem with navigating to the site, or clicking the appropriate link (there are several arranged by date).
The issue comes in actually saving the PDF. Chrome's PDF viewer uses an embedded bar at the top, so I cannot click on the Download button. The recorder only captures the entire frame:
So this leaves me with a couple of questions. Number one, I am curious if anyone has ever dealt with downloading PDFs like this, and what your solution was for an embedded button.
Secondly, I tried to do this via javascript, like so:
var urls = document.getElementsByTagName('a');
for (var i = 0; i < urls.length; i++) {
if (urls[i].innerHTML.includes('Deposit Account Agreement')) {
if (urls[i].innerHTML.includes('11/14/2021')) {
urls[i].download = "file.pdf";
urls[i].dispatchEvent(new MouseEvent('click'));
}
}
}
and while this works in the Browser Console, it does not work in the Bot - no error returned in a Try/Catch block, the Javascript action just stalls until it times out. I am curious if anyone knows why it would work in the browser but not in AA.
Either way, Recorder or javascript, I need to find a way to get this to work consistently. Any suggestions would be greatly appreciated.
.