robocorp / rpaframework

Collection of open-source libraries and tools for Robotic Process Automation (RPA), designed to be used with both Robot Framework and Python
https://www.rpaframework.org/
Apache License 2.0
1.17k stars 225 forks source link

RPA.Windows - Ability to check toggle state of Checkbox #1166

Open savitakul opened 7 months ago

savitakul commented 7 months ago

We are using RPA.Windows for desktop automation, we are trying to find ways to get the toggle state of checkbox and act on UI accordingly. We do not find any RPA.Windows keyword that provides this information. Can you please let us know if we can have such keyword for checkbox control?

mikahanninen commented 7 months ago

Yes, that can be done. I will add related functionality to the library.

KamilSoko commented 7 months ago

Hi,

you can always define such keyword in custom library like this:

  1. custom_lib.py

    @keyword
    def get_checkbox_state_py(checkbox_control: CheckBoxControl) -> bool:
    toggle = checkbox_control.GetTogglePattern()
    return toggle.ToggleState
  2. custom_resource.resource

Get Checkbox State
    [Arguments]    ${checkbox_locator}

    ${checkbox_control} =    Get Element    ${checkbox_locator}
    ${state} =    Get Checkbox State Py    ${checkbox_control.item}
    RETURN    ${state}
MoonOnHead commented 6 months ago

I am also looking for this functionality, can you please update once its implemented. @KamilSoko can you please give more details like library references n all