question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.click() element of control_type=Pane

See original GitHub issue

I have an element: {'class_name': 'WindowsForms10.Window.8.app.0.3b93019_r36_ad1', 'friendly_class_name': 'Pane', 'texts': [' On '], 'control_id': 328786, 'rectangle': <RECT L121, T476, R141, B496>, 'is_visible': True, 'is_enabled': True, 'control_count': 0, 'is_keyboard_focusable': True, 'has_keyboard_focus': False, 'automation_id': 'm_7b4cbcbae7174e47929ddd7339f80b0d'}

Control Identifiers: Pane - ' On ' (L751, T747, R771, B767) [' On ', 'Pane', ' On Pane'] child_window(title=" On ", auto_id="m_7b4cbcbae7174e47929ddd7339f80b0d", control_type="Pane")

Output from Inspect.exe:

  • hwnd=0x00050452 32bit class=“WindowsForms10.Window.8.app.0.3b93019_r36_ad1”
  • ControlType: UIA_PaneControlTypeId (0xC371)
  • LocalizedControlType: “pane”
  • Name: " On "
  • ClassName: “WindowsForms10.Window.8.app.0.3b93019_r36_ad1”
  • NativeWindowHandle: 0x50452
  • IsOffscreen: false
  • FrameworkId: “WinForm”
  • ProviderDescription: “[pid:6960,hwnd:0x50452 Main:Nested [pid:1908,hwnd:0x50452 Main(parent link):Microsoft: MSAA Proxy (unmanaged:uiautomationcore.dll)]; Hwnd(parent link):Microsoft: HWND Proxy (unmanaged:uiautomationcore.dll)]”

The element looks like a CheckBox, but raises AttributeError: Neither GUI element (wrapper) nor wrapper method 'click' were found (typo?) upon .click(), and raises NoPatternInterfaceError upon .invoke() and .select(). I believe this error is because it’s a Pane control_type.

.click_input() works fine, but I would prefer to not have the window and button visible.

I should also note that all of the above is identical with both ‘uia’ or ‘win32’ backends.

My question: is it possible to get .click() to work on this element?

Thanks in advance.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
vasily-v-ryabovcommented, Dec 4, 2019

It’s worth trying methods .toggle() and .select(). Method .click() is an alias for .invoke() for pure buttons only. Otherwise use .click_input() method as a usual click by mouse.

0reactions
benton-andersoncommented, Dec 5, 2019

That’s good to know. I’ll mark as closed because I have a good solution. I plan to use .set_focus() and then .move_window() to ensure robust button clicking. Thanks for all the help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

UI Automation Support for the Pane Control Type
Represents a UI Automation element in the UI Automation tree, and contains values used as identifiers by UI Automation client applications.
Read more >
Methods available to each different control type
These functions are aviailable to all controls. capture_as_image · click · click_input · close · close_click · debug_message · double_click · double_click_input ...
Read more >
WPF Pane - Read Text using PyWinAuto - Stack Overflow
The challenge which I am facing is how to use Inspect.exe and pywinauto together to read the text data. Is there any way...
Read more >
pywinauto/pywinauto - Gitter
click() but it tells me that the control does not have a get item method for item access. This surprises me because previously...
Read more >
Set text on a control using IUIAutomation. - AutoIt
Mouse position is retrieved 433-228 At least we have an element ... is: <Desktop> Class := <#32769> controltype:= <UIA_PaneControlTypeId> ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found