Skip to content

Conversation

ankur22
Copy link
Contributor

@ankur22 ankur22 commented Aug 19, 2025

What?

This adds locator.locator nesting.

Why?

It allows us to define locators relative to a parent locator e.g.:

await page
  .locator('[data-testid="inventory"]')
  .locator('[data-item="apples"]')
  .locator('button.add')
  .click();

Without this, there is no way to perform such a nesting. This functionality will be more useful once we start to implement APIs that require such nesting, such as locator.getBy*.

Checklist

  • I have performed a self-review of my code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests for my changes.
  • I have run linter and tests locally (make check) and all pass.

Checklist: Documentation (only for k6 maintainers and if relevant)

Please do not merge this PR until the following items are filled out.

Related PR(s)/Issue(s)

#5030

@ankur22 ankur22 added this to the v1.3.0 milestone Aug 19, 2025
@ankur22 ankur22 force-pushed the add/locator-locator branch from a0a7a1f to 659655a Compare August 19, 2025 15:24
@ankur22 ankur22 marked this pull request as ready for review August 19, 2025 15:49
@ankur22 ankur22 requested a review from a team as a code owner August 19, 2025 15:49
@ankur22 ankur22 requested review from inancgumus, mstoykov and oleiade and removed request for a team and oleiade August 19, 2025 15:49
Copy link
Contributor

@inancgumus inancgumus left a comment

Choose a reason for hiding this comment

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

🚀 Useful!

@ankur22 ankur22 merged commit c3d9ac3 into master Aug 20, 2025
37 checks passed
@ankur22 ankur22 deleted the add/locator-locator branch August 20, 2025 15:08
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.

3 participants