rpaframework icon indicating copy to clipboard operation
rpaframework copied to clipboard

RPA.Windows - Ability to check toggle state of Checkbox

Open savitakul opened this issue 1 year ago • 4 comments

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?

savitakul avatar Mar 27 '24 12:03 savitakul

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

mikahanninen avatar Apr 04 '24 09:04 mikahanninen

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
  1. 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}

KamilSoko avatar Apr 17 '24 13:04 KamilSoko

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

MoonOnHead avatar Apr 25 '24 11:04 MoonOnHead

Reading toggle state of a Checkbox in Windows applications using RPA.Windows would be nice.

In the documentation of RPA.Windows the following is_selected keyword with example is presented. Maybe this could be modified to accept CheckBoxControl.

from RPA.Windows import Windows

lib_win = Windows() value = lib_win.is_selected("type:RadioButtonControl name:Apple") print(value)

kmyllykoski avatar Sep 20 '25 20:09 kmyllykoski