MarketSquare / MarketSquare/robotframework-browser

Add `location` key (url, line, column) to `Get Page Errors` entries

Open
#5,112 0 comments 0 reactions 1 assignee View on GitHub

@Snooz82 is already working on this.

Since Aug 6, 2026.

enhancement
Dominant language
Python
Stars
655
Forks
147
Avg merge
5h 27m
Merged PRs (30d)
59

Description

Use case

Get Page Errors returns accumulated uncaught page errors, but pinpointing which script threw currently means parsing the free-form stack trace string — brittle and different per browser. Playwright 1.60 introduced the weberror context event, whose WebError carries a structured source location. Surfacing it lets users assert directly on the offending script URL, line and column, e.g. to verify a third-party script is (or is not) the source of console errors, without any string parsing. Today no structured alternative exists.

Proposed keyword / arguments

No new keyword and no signature change — each dict in the list returned by Get Page Errors gains a key:

  • location — dict {url, line, column} of the error source (may be empty/None when the browser does not report a location)
*** Test Cases ***
Error Comes From Our Bundle Not The Ad Script
    New Page    ${TEST_APP_URL}/broken
    Click    id=trigger-error
    ${errors}=    Get Page Errors
    Should Contain    ${errors[0].location.url}    /static/app.bundle.js
    Should Be True    ${errors[0].location.line} > 0

The existing assertion-engine arguments of Get Page Errors keep working as before.

Playwright API

webError.location (v1.60), delivered via the browserContext.on('weberror') event.

Implementation notes

  • node/playwright-wrapper/playwright-state.ts: the page-error accumulator currently feeds from the page-level pageerror event; switch (or augment) capture to the context-level weberror event so the location object is available, attributing each error to its page via webError.page(), and store location alongside the existing fields.
  • Browser/keywords (get_page_errors): document the new location key. No proto changes expected — the entries already travel as JSON.
  • atest: test-app page that throws from a known script/line; assert on location.url/line.

Backwards compatibility

Fully additive: the entry dicts only gain a location key; existing keys, ordering and the keyword signature are unchanged. Suites asserting on the message/stack text keep working.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.