79265811

Date: 2024-12-09 17:00:18
Score: 1
Natty:
Report link

I am in a similar situation. I am using selenium to access a webpage, navigate to a specific page and then clin on a link that opens the print dialog. I am planing on then connecting to the print dialog using the pywinauto to set up the printing options and print de document, but I am having plenty of issues locating the elements. When I use Inspect, I can locate the elements just fine, but when I execute my code that connects to the already opened crome window and then print I am unable to locate the ui elements.

Screen capture of inspect.exe and the elements that I wish to interact with

When executing the following code:

from pywinauto.application import Application

app = Application(backend="uia").connect(title_re=".*- Google Chrome -.*")


win = app.window(best_match="using pywinauto, how can I draw a rectangle arround a ui element?")
win.print_control_identifiers()

The control identifiers do not display anything that looks remotely similar to the ui elements I need to access.

The most I have been able to locate in the control identifiers tree is the following:

   | Pane - 'Print'    (L299, T78, R1622, B955)
   | ['Print', 'PrintPane', 'Pane22']
   | child_window(title="Print", control_type="Pane")
   |    | 
   |    | Pane - ''    (L299, T78, R1622, B955)
   |    | ['Pane23']
   |    |    |
   |    |    | Pane - ''    (L299, T78, R1622, B955)
   |    |    | ['Pane24']
   |    |    |    | 
   |    |    |    | Pane - ''    (L0, T0, R0, B0)
   |    |    |    | ['Pane25']
   |    |    |    | 
   |    |    |    | Pane - ''    (L306, T83, R1615, B946)
   |    |    |    | ['Pane26']

Which seems to have something to do with the Print dialog, but I can't locate anything that looks like any of the drop-downs I need to interact with.

Any pointers will be greatly appreciated since I have been strugling with this for days.

Reasons:
  • Blacklisted phrase (1): appreciated
  • Blacklisted phrase (0.5): how can I
  • Blacklisted phrase (0.5): I need
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: osantos