Skip to content

Conversation

Artur-
Copy link
Member

@Artur- Artur- commented Oct 7, 2025

No description provided.

When using ElementQuery with conditions like withPropertyValue(),
calling first() or get(index) would fail if the element at that
DOM position didn't match the condition.

This happened because the JavaScript [index] was applied before
Java-side condition filtering, so it would extract the wrong element
and then filter it out.

Fixed by:
- Modified get(int index) to check if conditions exist
- When conditions exist, fetch all elements and apply index after filtering
- When no conditions exist, use the optimized JavaScript [index] path

Added integration tests to verify withPropertyValue().first() and
withPropertyValue().get(0) work correctly.

Fixes #2033
@mshabarov
Copy link
Contributor

Fixes #2033.

@mshabarov mshabarov requested a review from tepi October 13, 2025 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants