longvh211 / Chromium-Automation-with-CDP-for-VBA

A method to directly automate Chromium-based web browsers, such as Chrome, Edge, and Firefox, using VBA for Office applications by following the Chrome DevTools Protocol framework.
MIT License
44 stars 5 forks source link

Failed to switch to print dialogue in chrome to get element and press print button #32

Closed aczone closed 1 month ago

aczone commented 1 month ago

First of all Thank you so much for the great framework which saved me lots of time. my code automated chrome to open and print a pdf embedded on a internal web page(it is hard to get the link) and I succeeded to open the print dialogue of chrome. I would like to then change the printer option and press the print button. I inspected the elements of the print dialogue (chrome://print/) I used the demo code provided to switch because it seems to be on a different tab as the parent page but I still failed to get any elements on the print dialogue. May I know how could I do so? Dim targetTab As New CDPBrowser Set targetTab = chrome.getTab("chrome://print/") targetTab.wait

longvh211 commented 1 month ago

Hi, print dialogue is usually not an html dialogue but a windows dialogue. You can only automate such with UIA framework.