Skip to content

[BUG] aria-checked should be take in count when check locator.is_disabled/is_enabled #21428

@Elichy

Description

@Elichy

Context:

  • Playwright Version: 1.25.2
  • Operating System: Mac
  • Python version: 3.7.9
  • Browser: chrome

Code Snippet

self.syslog_whole_frame_parent.locator('//button[@role="switch"]').is_enabled()

return always True and is disabled return always False no matter if the button is on or of.
The relevant element:

<button role="switch" type="button" aria-checked="false"
    class="relative inline-flex h-4 w-8 flex-shrink-0 focus:outline-none focus:ring rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out cursor-pointer hover:ring bg-gray-600 dark:bg-gray-300"><span
        class="pointer-events-none inline-block h-3 w-3 rounded-full text-dark-bg shadow dark:text-default transform transition duration-200 ease-in-out translate-x-0"
        aria-hidden="true"><span
            class="absolute inset-0 flex h-full w-full items-center justify-center transition-opacity opacity-100 duration-200 ease-in"><svg
                aria-hidden="true" focusable="false" role="img" viewBox="0 0 496 512"
                class="inline-block overflow-visible align-middle h-4 w-4" style="height: 100%; width: 100%;">
                <path fill="currentColor"
                    d="M248 8C111.03 8 0 119.03 0 256s111.03 248 248 248 248-111.03 248-248S384.97 8 248 8zm176 296H72c-8.84 0-16-7.16-16-16v-64c0-8.84 7.16-16 16-16h352c8.84 0 16 7.16 16 16v64c0 8.84-7.16 16-16 16z">
                </path>
            </svg></span><span
            class="absolute inset-0 flex h-full w-full items-center justify-center transition-opacity opacity-0 duration-100 ease-out"><svg
                aria-hidden="true" focusable="false" role="img" viewBox="0 0 512 512"
                class="inline-block overflow-visible align-middle h-4 w-4" style="height: 100%; width: 100%;">
                <path fill="currentColor"
                    d="M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z">
                </path>
            </svg></span></span></button>

The locator is_enabled/disabled should also check aria-checked if it is true or false

Add any other details about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions