How to test toggle button status?

Hi,
I am stuck at one scenario.
I want to test the on / off or in other words Enabled / Disabled status of toggle button in my web application using robot framework. In both of / off status I am getting same web element so it is getting hard to handle it. Any solution? I am using robot framework / Python / Selenium.

image

Thanks.

Do you have the HTML corresponding to that element when it is on or off?

Above is the inspect element result

Below are Xpath and full xpath which is same when toggle is enabled or disabled.
//*[@id=“tabTest”]/div[2]/div[2]/div[2]/label
/html/body/div[2]/div[2]/div[4]/div[1]/div[2]/div/div[1]/div[2]/div[2]/div[2]/label

Maybe you could have taken a html screenshot for 2 buttons (one on and one off) so we could check for differences.
BTW, that xpath is awfull, it is not at all reliable.

Which screenshot you want me to take exactly in html?

I tried below but not working

{style}= Get Element Attribute xpath=//*[@id="tabtest"]/div[2]/div[1]/div[2]/label/span background-color {style} {bgcolor} Split String {style} background-color:
log {style} log {bgcolor}

Below code is worked for me for me to get background color of toggle button. It will helpful to take the action based on toggle button enabled(Green in color) and disabled(Grey in color) .

 ${BG}   Get WebElement     xpath=(//span[@class="slider round"])[3]
    ${bg color}    Call Method    ${BG}    value_of_css_property    background-color
    Run Keyword If    '${bg color}' == 'rgba(204, 204, 204, 1)'
    ...   Click Element     xpath=(//span[@class="slider round"])[3]
    ...   ELSE
    ...   Click Element    xpath=//*[@id="app"]/div[2]/div[4]/div[1]/div[1]/div/div/ul/li[2]/a