Skip to content
New issue

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

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

Already on GitHub? # to your account

RPA.Windows how to get an element by value ? #1213

Open
AttaM1rza opened this issue Feb 11, 2025 · 2 comments
Open

RPA.Windows how to get an element by value ? #1213

AttaM1rza opened this issue Feb 11, 2025 · 2 comments
Labels
enhancement Improve an existing feature

Comments

@AttaM1rza
Copy link

How can I get an element based on the value ?
Wouldn't a locator make sense for that usecase ? for example: "value:Vorschau"

This is my specific usecase example, on which Im working on:
I want to get the Element with the Value: "Vorschau"
Image

alternative possibilities:

  • using subname, re => only applicable to the "Name" attribute not "Value" attribute.
  • using for loop => but the problem, is that im working with a tablegrid with many entries.
@mikahanninen
Copy link
Member

Thank you for the suggestion. I think that a locator could be possible.

@mikahanninen mikahanninen added the enhancement Improve an existing feature label Feb 11, 2025
@mikahanninen
Copy link
Member

mikahanninen commented Feb 11, 2025

If you are brave enough you can get more "stuck in" and you might be able to handle those elements with Values with the current version of rpaframework.

    lib = Windows()
    window = lib.control_window('name:"Sema4.ai Studio" type:Pane')
    # The 'WindowsElement' type (above 'window' is of this type) returned by most of RPA.Windows keywords 
    # contains 'item' property, which contains uiautomation class instance (underlying package used by the 
    # library). Via this instance it is possible to access different methods and properties as the library 
    # does.
    #
    # Control type needs to match type of the element being searched, in my case 'ComboBoxControl'
    # 
    # Searching for element with the 'Value' of 'Bug bash'
    item = window.item.ComboBoxControl(
        searchDepth=10,
        Value="Bug bash",
    )
    # Access the 'Name' property of the found element
    print(item.Name)
    # Mouse click element
    item.Click()
    # Send keys to the element
    item.SendKeys("Hello")

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement Improve an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants