webdriver: consider boolean attribute when get element attribute (#38401)

The function handle_get_attribute should act differently when the
attribute is a boolean attribute.

The full list of attributes can be found in [1]. All attributes marked
as "Boolean attribute" in the "Value" column are boolean attributes.
Note that "hidden" is effectively treated as a boolean attribute,
according to WPT test "test_global_boolean_attributes" in
webdriver/tests/classic/get_element_attribute/get.py

[1] https://html.spec.whatwg.org/multipage/#attributes-3

Testing: Updated WPT test expectation
Fixes: #38353

---------

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
This commit is contained in:
Kingsley Yung 2025-08-01 16:44:26 +08:00 committed by GitHub
parent 05ad9026f5
commit 5e8754bb1d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 57 additions and 60 deletions

View file

@ -1,60 +1,3 @@
[get.py]
[test_no_browsing_context]
expected: FAIL
[test_boolean_attribute[audio-attrs0\]]
expected: FAIL
[test_boolean_attribute[button-attrs1\]]
expected: FAIL
[test_boolean_attribute[details-attrs2\]]
expected: FAIL
[test_boolean_attribute[dialog-attrs3\]]
expected: FAIL
[test_boolean_attribute[fieldset-attrs4\]]
expected: FAIL
[test_boolean_attribute[form-attrs5\]]
expected: FAIL
[test_boolean_attribute[iframe-attrs6\]]
expected: FAIL
[test_boolean_attribute[img-attrs7\]]
expected: FAIL
[test_boolean_attribute[input-attrs8\]]
expected: FAIL
[test_boolean_attribute[menuitem-attrs9\]]
expected: FAIL
[test_boolean_attribute[ol-attrs10\]]
expected: FAIL
[test_boolean_attribute[optgroup-attrs11\]]
expected: FAIL
[test_boolean_attribute[option-attrs12\]]
expected: FAIL
[test_boolean_attribute[script-attrs13\]]
expected: FAIL
[test_boolean_attribute[select-attrs14\]]
expected: FAIL
[test_boolean_attribute[textarea-attrs15\]]
expected: FAIL
[test_boolean_attribute[track-attrs16\]]
expected: FAIL
[test_boolean_attribute[video-attrs17\]]
expected: FAIL
[test_global_boolean_attributes]
expected: FAIL