You might need to make sure you are attaching to the pop-up window before you try clicking anything in it, because it is a different browser instance.
We've had some trouble with the nested PDF viewer in a browser window in the past. The following steps are usually what we use (and I would like to point out that we really only use keystrokes when absolutely necessary, so this is one of those cases):
WebAutomation.LaunchChrome.AttachToChromeByTitle TabTitle: $'''{InsertPopupTitleHere}''' AttachTimeout: 5 BrowserInstance=> BrowserPDF
WebAutomation.GetDetailsOfWebPage BrowserInstance: BrowserPDF DetailsType: WebAutomation.DetailsType.URLAddress Details=> WebPageProperty
WebAutomation.CloseWebBrowser BrowserInstance: BrowserPDF
WebAutomation.CreateNewTab.CreateNewTab BrowserInstance: BrowserMain Url: WebPageProperty NewBrowserInstance=> BrowserPDF
MouseAndKeyboard.SendKeys.FocusAndSendKeysByTitleClass Title: $'''Bankafstemning * - Google Chrome''' Class: $'''''' TextToSend: $'''{Control}({S})''' DelayBetweenKeystrokes: 10 SendTextAsHardwareKeys: False
What it does is::
- Attaches to the PDF viewer pop-up and creates a new browser instance for that
- Retrieves the URL from the pop-up
- Closes the pop-up
- Opens the same URL as a new tab in the main browser window
- Sends Ctrl+S to this new tab, so that it calls out the Save As window of Chrome.
You would then need the usual UI controls to save the file and then would also need to use Close browser again to close this new tab and return to the original one. But this works without failure when done right.
-------------------------------------------------------------------------
If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.
I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.