[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

@ -2278,6 +2278,7 @@ impl ScriptThread {
selector,
partial,
reply,
can_gc,
)
},
WebDriverScriptCommand::FindElementTagName(selector, reply) => {
@ -2304,6 +2305,7 @@ impl ScriptThread {
selector,
partial,
reply,
can_gc,
)
},
WebDriverScriptCommand::FindElementsTagName(selector, reply) => {
@ -2336,6 +2338,7 @@ impl ScriptThread {
selector,
partial,
reply,
can_gc,
),
WebDriverScriptCommand::FindElementElementTagName(selector, element_id, reply) => {
webdriver_handlers::handle_find_element_element_tag_name(
@ -2368,6 +2371,7 @@ impl ScriptThread {
selector,
partial,
reply,
can_gc,
),
WebDriverScriptCommand::FindElementElementsTagName(selector, element_id, reply) => {
webdriver_handlers::handle_find_element_elements_tag_name(