Skip to content

fix(recorder): pick on the page the user works on - #5424

Merged
Snooz82 merged 2 commits into
MarketSquare:mainfrom
Snooz82:fix/recorder-pick-page
Nov 1, 2026
Merged

Snooz82 merged 2 commits into
MarketSquare:mainfrom
Snooz82:fix/recorder-pick-page

Conversation

@Snooz82

@Snooz82 Snooz82 commented Nov 1, 2026

Copy link
Copy Markdown
Member

Problem

The toolbar's Pick button, and Playwright's own Pick locator button, picked on Browser's active page. A recording never changes that page, so after a click that opened a new tab the pick jumped back to the original tab.

Reproduce with Browser 21.0.0:

*** Test Cases ***
Test
    New Browser    headless=False
    New Page    https://robotframework.org
    Record Keyword    Pick In A New Tab

Click More info, which opens robocon.io in a new tab; the recording adds Switch Page NEW. Press Pick in the new tab: the pick runs on robotframework.org instead.

Fix

  • A pick starts on the page whose toolbar sent the command: exposeBinding passes the page a toolbar command comes from.
  • Playwright's Pick locator mode applies to the whole context and does not say where it was pressed. The toolbar notes the time of the last real press on every page, and the pick starts on the page pressed last. Focus does not tell: Playwright reports every page as focused.
  • Counting and highlighting the picked selector run on the page it was picked in, not on Browser's active page (locatorOn).
  • A selector already picked stays on its page; only a new pick moves to another one.

Tests

  • Pick Starts On The Page Its Button Was Pressed On: Browser's active page stays the first one, and the pick command comes from the toolbar of a second window.
  • Playwright's Pick Locator Picks On The Page Pressed Last: a press on the second window, then Playwright's Pick locator; the pick must arrive there.
  • Both fail on 21.0.0 and pass with the fix, five runs each.
  • Jest checks that a pick counts on its own page.

The toolbar's Pick button picked, counted and highlighted on Browser's active
page, which a recording never changes: after a popup it picked on the page
behind it. A pick now starts on the page whose toolbar sent the command, or,
for Playwright's Pick locator button, on the page pressed last, and counts and
highlights on the page it picked in.
Copilot AI balanced review requested due to automatic review settings November 1, 2026 19:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

There are no active review issues for the changes that keep recorder picks tied to the user’s working page.

No open issues 🎉

What changed in this PR

This PR makes recorder picks follow the page the user is working on rather than Browser’s active page, addressing picks that return to the original tab after opening a new one.

Changes:

  • Tracks toolbar command origins and recent presses to choose the page for a new pick.
  • Counts and highlights selectors on the page where they were picked.
  • Adds multi-window acceptance tests and updates page-specific unit coverage.
File Description
node/​playwright-wrapper/​static/​recorder-toolbar.js Tracks trusted presses and clears tracking on removal.
node/​playwright-wrapper/​selector-picker.ts Uses the page-bound picker interface.
node/​playwright-wrapper/​recorder.ts Routes new picks to the user’s page while preserving existing selections.
node/​playwright-wrapper/​playwright-invoke.ts Adds selector resolution on an explicit page.
node/​playwright-wrapper/​element-picker.ts Counts and highlights using the pick’s page.
node/​playwright-wrapper/​__tests__/​selector-picker.test.ts Updates mocks and verifies page-specific locator use.
atest/​test/​02_Content_Keywords/​recorder.robot Adds multi-window coverage for both pick entry points.

Review effort: Balanced

On Python 3.11 a comprehension has its own scope, where Robot Framework
cannot resolve `$before`; a set difference needs none.
@sonarqubecloud

sonarqubecloud Bot commented Nov 1, 2026

Copy link
Copy Markdown

@Snooz82
Snooz82 merged commit 29eff13 into MarketSquare:main Nov 1, 2026
31 checks passed
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