{{ message }}
Repository navigation
Conversation
…t list undefined A $$([elemA, elemB]) list whose elements come from different selectors has no selector to run again, but an index past its end still re-ran $$ with an undefined selector and surfaced its error inside waitUntil (webdriverio#16122). Mark such lists non-refetchable in prepareMetadata, like derived lists, so an index past the end resolves to undefined and reading it without awaiting no longer leaves an unhandled rejection.
Contributor
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What
Fixes #16122.
$$([elemA, elemB])normalizes to a single selector only when every element shares one; otherwise the list has no selector and can never be re-queried. ButelementAtstill treated such a list as an original query: an index past the end calledparent[foundWith](selector, ...props)withselector === undefined,findElementsthrewselector needs to be typeof `string` or `function`, but found: `undefined`insidebrowser.waitUntil, and the catch inelementAtrethrew it because the message is not thetimeoutMsg. Reading the index withoutawaitadditionally left an unhandled rejection, becausereadIndexreturned a truthy chained proxy whose promise rejected with no handler.The fix marks a list non-refetchable in
prepareMetadatawhen its selector was an element array thatnormalizeSelectorcould not reduce to one selector, mirroringderivedMetadata. An index past the end then resolves toundefined(the second acceptance option in the issue, and what aslice()/filter()list already does), andreadIndexreturns the rawundefinedfor a resolved list, so there is no chained proxy and no unhandled rejection.Lists whose elements share one selector keep refetching as before, and
$$(selector)lists are untouched.Test output (before the fix)
The unhandled rejection in the run above is the second reported symptom of the issue, reproduced by the unit test without any browser.
Test output (after the fix)
Notes
prepareMetadatainpackages/webdriverio/src/element/array.ts.AI assistance was used to draft this change; the code and tests were verified by hand.