Checkbox Slider Status unable to get

Hi Folks,
I’m beginner in robot automation and facing a problem getting the status of that slider.

Browser.Click //*[@data-at-whatever]

works fine. So I have no doubts that there is a locator Issue.
For my test I only need the VALUES true/false from data-at-whatever or aria-checked.
I tried the following keywords:

Browser.Get Attribute    //*[@data-at-whatever]    aria-checked
Browser.Get Property    //*[@data-at-whatever]   aria-checked
Browser.Get Checkbox State   //*[@data-at-whatever]

All of them are failing either the attributre property is not found or the locator has no checkbox.
Attached the DOM. May you can help me to figure out what keyword is the correct one.
Thx.

<mat-slide-toggle _ngcontent-aim-c589="" class="mat-slide-toggle slide-toggle mat-accent"
    data-at-whatever="false" id="mat-slide-toggle-3"><label class="mat-slide-toggle-label"
        for="mat-slide-toggle-3-input"><span class="mat-slide-toggle-bar"><input type="checkbox" role="switch"
                class="mat-slide-toggle-input cdk-visually-hidden" id="mat-slide-toggle-3-input" tabindex="0"
                aria-checked="false"><span class="mat-slide-toggle-thumb-container"><span
                    class="mat-slide-toggle-thumb"></span><span mat-ripple=""
                    class="mat-ripple mat-slide-toggle-ripple mat-focus-indicator"><span
                        class="mat-ripple-element mat-slide-toggle-persistent-ripple"></span></span></span></span><span
            class="mat-slide-toggle-content"><span style="display: none;">&nbsp;</span> 1x support
        </span></label></mat-slide-toggle>

Hi @Birger,

The HTML snippet you gave is not a single element but rather a series of elements that make a styled object on a page.

The element you are selecting is only this:

<mat-slide-toggle _ngcontent-aim-c589="" class="mat-slide-toggle slide-toggle mat-accent" data-at-whatever="false" id="mat-slide-toggle-3">

Because this is not an <input> element of type “checkbox” or “radio”, Browser.Get Checkbox State will not work.

Likewise because the element you selected doesn’t have an attribute of “aria-checked”, Browser.Get Attribute and Browser.Get Property will probably fail with a message telling you that.

From looking at your HTML snippet there are a few things you could try:

  • Browser.Get Checkbox State //*[@data-at-whatever]/input
  • Browser.Get Attribute //*[@data-at-whatever]/input aria-checked
  • Browser.Get Attribute //*[@data-at-whatever] data-at-whatever

There’s other ways as well but ,I think these will probably give you the result you are after without too much complexity.

Dave.