Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tools tips in windows? #1141

Open
bruce-optibrium opened this issue Jan 11, 2024 · 1 comment
Open

Tools tips in windows? #1141

bruce-optibrium opened this issue Jan 11, 2024 · 1 comment

Comments

@bruce-optibrium
Copy link

I am experimenting with RPA.windows.
I don't grok the robot syntax at all I'd rather use pure python but I don't grok the python API either yet and it isn't as well documented.

Looking with accessiblity insights I see some text called "FullDescription" which corresponds to a tooltip
but there is no matching attribute if I list the attributes of that element.

Are there some limitations to robot here or is there a way to get this?
An example of an element with this is the find button in a word document.

image

Here is a hacky script to list the attributes via RPA.Windows

from RPA.Windows import Windows 

lib=Windows()
tree = lib.print_tree("class:NetUIRibbonButton", return_structure=True)
p.pprint(tree)

items = lib.get_elements("class:NetUIRibbonButton")
p.pprint(items);

for item in items:
   attributes = lib.list_attributes(item)
   p.pprint(attributes);
   for attr in attributes:
      p.pprint(attr);
      result = lib.get_attribute("class:NetUIRibbonButton", attr)
      if result is not None:
         print("attr={}".format(result))

This isn't a great example as "NetUIRibbonButton" might correspond to other elements. Though it reproduces the error on the custom application I'm looking at where the element is sufficiently unique.

I also tried using the automation id as a locator for this example like "id:NavigationPaneFind" and it doesn't work. What are some more correct ways to do this?

Anyway this lists the attributes as:


[   'AcceleratorKey',
    'AccessKey',
    'AriaProperties',
    'AriaRole',
    'AutomationId',
    'BoundingRectangle',
    'ClassName',
    'ControlType',
    'ControlTypeName',
    'CreateControlFromControl',
    'CreateControlFromElement',
    'Culture',
    'Element',
    'FrameworkId',
    'HasKeyboardFocus',
    'HelpText',
    'IsContentElement',
    'IsControlElement',
    'IsDataValidForForm',
    'IsEnabled',
    'IsKeyboardFocusable',
    'IsOffscreen',
    'IsPassword',
    'IsRequiredForForm',
    'ItemStatus',
    'ItemType',
    'LocalizedControlType',
    'Name',
    'NativeWindowHandle',
    'Orientation',
    'ProcessId',
    'ProviderDescription',
    'ValidKeys',
    'foundIndex',
    'regexName',
    'robocorp_click_offset',
    'searchDepth',
    'searchFromControl',
    'searchInterval',
    'searchProperties']

None seem to correspond to "FullDescription".

@kkotenko
Copy link
Contributor

At a first glance, it appears to me that the underlying Python API of uiautomation does not expose this property. However, you may be able to add it to (your local copy of) the uiautomation.py file:

https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/abb247330bcba4fdb9244f669f451edcab5f4125/uiautomation/uiautomation.py#L6003

    @property
    def FullDescription(self) -> str:
        """
        Property FullDescription.
        Call IUIAutomationElement::get_CurrentFullDescription.
        Return str, such as Win32, WPF...
        Refer https://learn.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement6-get_currentfulldescription
        """
        return self.Element.CurrentFullDescription

That should also add it to the above attribute list, I think. (Note I am not a maintainer or anything, I just have happened to look under the hood.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants