Skip to content

Conversation

@yezhizhen
Copy link
Member

@yezhizhen yezhizhen commented Nov 23, 2025

... and reduce code duplication in element retrieval. Note that we are not using the functionality of "wait on error" yet.

Testing: We added WPT tests for "Find element", "Find element from element", "Find element from shadow root" for both successful implicit wait and timeout case.

@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 23, 2025
@yezhizhen yezhizhen requested a review from TimvdLippe November 25, 2025 08:08
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
@yezhizhen
Copy link
Member Author

yezhizhen commented Nov 26, 2025

This is a good opportunity to add wpt test for this functionality. Maybe in another PR.

I did it here.

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
@servo-wpt-sync
Copy link
Collaborator

🤖 Opened new upstream WPT pull request (web-platform-tests/wpt#56292) with upstreamable changes.

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
@servo-wpt-sync
Copy link
Collaborator

✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#56292) title and body.

@servo-wpt-sync
Copy link
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#56292).

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
@servo-wpt-sync
Copy link
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#56292).

@yezhizhen yezhizhen requested a review from TimvdLippe November 26, 2025 08:50
@servo-wpt-sync
Copy link
Collaborator

✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#56292) title and body.

@yezhizhen
Copy link
Member Author

We can also add tests for plural command (Elements) if really want.. But I'm exhausted.

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Nov 27, 2025
@TimvdLippe TimvdLippe enabled auto-merge November 27, 2025 07:48
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 27, 2025
@TimvdLippe
Copy link
Contributor

Ugh. The GitHub UI jumped around and now I accidentally clicked update...

@servo-wpt-sync
Copy link
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#56292).

@TimvdLippe TimvdLippe added this pull request to the merge queue Nov 27, 2025
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 27, 2025
@yezhizhen yezhizhen removed this pull request from the merge queue due to a manual request Nov 27, 2025
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 27, 2025
@yezhizhen
Copy link
Member Author

Ugh. The GitHub UI jumped around and now I accidentally clicked update...

Somehow upstream export got closed after it. I will repush this.

Thanks for the review!

@servo-wpt-sync
Copy link
Collaborator

🤖 Opened new upstream WPT pull request (web-platform-tests/wpt#56324) with upstreamable changes.

@yezhizhen yezhizhen added this pull request to the merge queue Nov 27, 2025
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 27, 2025
Merged via the queue into servo:main with commit f9c0fc8 Nov 27, 2025
55 checks passed
@yezhizhen yezhizhen deleted the wait-on-error branch November 27, 2025 09:58
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 27, 2025
}, 300);
</script>
""")
session.timeouts.implicit = 1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI. The timeout should be reset to its default value at the end of the test. I'm going to do that once the patch landed in our Firefox repository. I've filed https://bugzilla.mozilla.org/show_bug.cgi?id=2002826 for it.

For the future feel free to ask for review for tests as well. I'm happy to give feedback for changes or additions to webdriver tests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reaching out!

But it seems the harness already automatically reset timeout everytime, when starting a new subtest? Is this really necessary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_current_session.timeouts.implicit = IMPLICIT_WAIT_TIMEOUT * multiplier
which is fixed to 0.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also see other tests that sets the implicit wait, without resetting them.

def test_find_element_while_frame_is_still_loading(session, url):
session.timeouts.implicit = 5

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only end and start a new session when the capabilities have changed. So normally it won't happen for all the tests that are part of a file. Thanks for finding this additional test. I'll take a look for that as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And following two.

def test_get_new_timeouts(session):
session.timeouts.script = 60
session.timeouts.implicit = 1
session.timeouts.page_load = 200

def test_set_all_fields(session):
timeouts = {"implicit": 10, "pageLoad": 20, "script": 30}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants