[WebDriver] Properly report error for find_element & find_elements; Get correct visible text when matching links (#37452)

1. Properly report new types of errors for `find_element` and
`find_elements`. Previously never reported.
1.1. `InvalidSelector`
1.2. `NoSuchElement`
1.3. `InvalidArgument`

2. Get the visible text for `<a>` correctly in
`script::webdriver_handler` so that matching would work.

Testing: `./mach test-wpt -r --log-raw "D:\servo test log\all.txt"
webdriver/tests/classic/find_element/find.py
webdriver/tests/classic/find_elements/find.py --product servodriver`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This commit is contained in:
Euclid Ye 2025-06-16 13:23:26 +08:00 committed by GitHub
parent 62b078dd62
commit f8f7c6ebd1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 138 additions and 122 deletions

View file

@ -2,15 +2,6 @@
[test_no_browsing_context]
expected: FAIL
[test_no_such_element_with_unknown_selector[not-existent\]]
expected: FAIL
[test_no_such_element_with_unknown_selector[existent-other-frame\]]
expected: FAIL
[test_no_such_element_with_unknown_selector[existent-inside-shadow-root\]]
expected: FAIL
[test_find_element[xpath-//a\]]
expected: FAIL

View file

@ -5,18 +5,6 @@
[test_find_elements[xpath-//a\]]
expected: FAIL
[test_find_elements_link_text[<a href=#>link<br>text</a>-link\\ntext\]]
expected: FAIL
[test_find_elements_link_text[<a href=# style='text-transform: uppercase'>link text</a>-LINK TEXT\]]
expected: FAIL
[test_find_elements_partial_link_text[<a href=#>partial link<br>text</a>-k\\nt\]]
expected: FAIL
[test_find_elements_partial_link_text[<a href=# style='text-transform: uppercase'>partial link text</a>-LINK\]]
expected: FAIL
[test_xhtml_namespace[xpath-//*[name()='a'\]\]]
expected: FAIL