Reputation: 1791
I have a program that deliberately blocked any text selection. They went so far to also make it not addressable even on the UI side of things. I want to get text information from the "Current Height" Static - '' objects. I can see the text on the interface but you can't click it and using WinSpy it also gives no information. The "Current height" that has title is just a label ('Static3') but the one with the information is recognized as 'Static4'.
Dialog - 'STATE MACHINE' (L378, T149, R1670, B933)
['STATE (Machine: 5799)', 'Dialog', 'STATE MACHINE']
child_window(title="STATE MACHINE", class_name="#32770")
|
| GroupBox - '' (L388, T200, R1662, B276)
| ['StateGroupBox', 'GroupBox', 'GroupBox0', 'GroupBox1']
| child_window(class_name="Button")
|
| Static - '' (L386, T265, R1662, B286)
| ['Static', 'StateStatic', 'Static0', 'Static1', 'StateStatic0', 'StateStatic1']
| child_window(class_name="Static")
|
| Static - '' (L386, T341, R1662, B362)
| ['Static2', 'StateStatic2']
| child_window(class_name="Static")
| Static - 'Current height:' (L625, T512, R700, B525)
| ['Static3', 'Current height:', 'Current height:Static', 'Current height:Static0', 'Current height:Static1']
| child_window(title="Current height:", class_name="Static")
|
| Static - '' (L625, T528, R1330, B606)
| ['Static4', 'Current height:Static2']
| child_window(class_name="Static")
Due to the program being proprietery I can't show the GUI.
Since print_control_identifiers() seems to see the object as 'Static4' is there a way for me to use that as an identifier? I can't seem to use:
label = win.child_window(title="static4", class_name="Static")
If I tried:
label.print_control_identifiers()
I would get Element not found error.
Upvotes: 1
Views: 505
Reputation: 320
According to the print elements above, there is no item that has the title of "static4" which is why the error is being thrown. It looks like the title for all listed elements is ''
.
The correct way to grab the element would be:
label = win.Static4
Doing this, you could then print the control identifiers. For reference see here where it talks about Marginsinches
.
Upvotes: 1