Help with locaitng a "save as" field for PDF saving

Hello, I created a macro which downloads a pdf periodically. I used StoreEval to store current date and time. Now when I save the pdf, I need to enter the name of the pdf, which is this variable I saved (date and time), but I cannot seem to find a way to locate that field. I don’t even need a locator since the chrome prompt box automatically lets you write the name of the file… how can I just type my saved variable in and that’s it?
Clarification:

Thanks…

I see the issue. This is a PDF page, not a HTML website. This means that the standard Selenium IDE commands like TYPE or CLICK do not work there.

Solution: Stay tuned for the release of the Kantu XDesktop module and the XType command in the next weeks :smiley:

1 Like

Very late reply here, but thank you!

Hey @admin, how do we tell the UI Vision macro to wait for the PDF to load and that ‘save file’ popup to appear before sending the XType command?

I ‘click’ a link which is to a PDF file. I have the Chrome built-in PDF viewer disabled so it automatically tries to download the file. But the PDF takes a variable amount of time to load for the ‘save file’ popup ot appear.

Not sure how to get the Macro to wait for that event since it’s not an html page. Any suggestions?

Hi, simple add a pause after the command to make the save file popup to appear.

It’s a variable amount of time for a given PDF to load, and I am iterating through a large list of PDFs to download each of them. I don’t want to pause for 10 seconds, when most take 2 seconds to load, but the occasional one takes 8 seconds, and a possible outlier might take 12 seconds in which case a 10 second pause would fail. and it’d be hard to identify after the fact that one in hundreds was missed.

Thus, I really want to be able to identify when the pdf has loaded sufficiently to trigger the dialog that is ready for using XType.

For additional context- I’m setting up this automation on a number of websites where I’m downloading long lists of PDF statements.

Scenario 1: Some websites cause the download click to trigger javascript which pops up a new browser window (not new tab) to load the PDF. And in these cases, I am able to successfully use the selectWindow command to select that popup. I’m able to automate the detection of it completing the popup load since selectWindow gives an error if that window name doesn’t yet exist. I use !statusOK and loop until it no longer fails.

Scenario 2: But other websites, the download pdf button opens a new tab to download the pdf. In this case, before the tab loads the PDF I get the following error:

"failed to find the tab with locator ‘title=Download PDF’ "

This is what’s expected before that window/tab opens, and is how I get my Scenario 1 example above to work, since after the PDF loads in the built-in Chrome PDF viewer, this failure ceases and it properly selects that window.

But here (Scenario 2), after the PDF loads in the new tab, the error changes to this: “Could not establish connection. Receiving end does not exist.”

I’m not sure what’s happening in Chrome under the hood with Scenario 1 loading a PDF in a new window opened by Javascript, versus Scenario 2, which has the download PDF button be submitting an html form (I haven’t fully dug in to understand what that’s triggering).

But whatever the difference is, is causing the new tab with the PDF loaded to be unselectable by selectWindow (“Could not establish connection. Receiving end does not exist.”).

Ok you can that that visually using visualVerify or with XRunAndWait and have a script wait for that window title to appear.

I’m trying to use visualVerify here. I use the select button to snapshot choose some of the PDF viewer icons which appear (download, print, three dots). But visualVerify is failing with the following error even though it’s most definitely on the screen: “Image ‘pdf_loaded_dpi_96.png’ (conf. = 0.6) not found”

I set an ample !timeout_wait to 30 seconds and the PDF viewer is definitely appearing before the timeout. I do also have “Desktop mode active” since it seemed that browser model might only work on html sites and not for the Chrome PDF viewer.

Any idea why visualVerify wouldn’t be finding the PDF viewer toolbar that is definitely appearing after a few seconds?

Try reducing the search area or reducing the confidence level ex. yourimage.png@0.50

@automator I assume this the same issue as in XMove/XClick cannot find the right spot - #5 ? <= If so, lets continue to discuss it in this new post. At his point, a screen video will be really helpful.

Correct, it appears whatever the issue was was equally affecting all visual commands. Continued in other post.

Did anyone figure out how to save a PDF file from a url?