MarketSquare / MarketSquare/robotframework-browser
Add `Set Page Content` keyword to set the page HTML directly
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 655
- Forks
- 147
- Avg merge
- 5h 27m
- Merged PRs (30d)
- 59
Description
Use case
Sometimes a test needs a page with exact, known HTML — component or snippet testing, reproducing a rendering bug, or exercising a keyword against a minimal DOM — without standing up a web server or writing a temporary file and navigating to a file:// URL (the current clumsy workaround). Playwright supports this directly with page.setContent, but the library does not expose it.
Proposed keyword / arguments
Set Page Content html *, wait_until=load timeout=None
html— the HTML markup to assign to the page (replaces the whole document).wait_until— load state to wait for, same enum asGo To/Reload(load,domcontentloaded,networkidle,commit); defaultload.timeout— maximum wait time (Robot Framework time format); falls back to the library timeout when omitted.
New Page
Set Page Content <h1>Hello</h1><button id="go" onclick="this.textContent='clicked'">Go</button>
Get Text h1 == Hello
Click id=go
Get Text id=go == clicked
Set Page Content ${LONG_SNIPPET} wait_until=domcontentloaded timeout=5s
Playwright API
Implementation notes
- New RPC in
protobuf/playwright.proto(html, waitUntil, timeout). - Trivial pass-through in
node/playwright-wrapperon the active page. - Python keyword (fits
Browser/keywords/playwright_state.pyor the getters/content module), docs, atest with a subsequent interaction/assertion on the injected content.
Backwards compatibility
Purely additive: a new keyword; no changes to existing keywords.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the related Go To and Reload RPC definitions in protobuf/playwright.proto, then inspect node/playwright-wrapper and the Python keyword modules suggested in the issue. Add an atest that injects HTML and performs a subsequent interaction and assertion, update the documentation, and verify wait_until and timeout behavior against the described Playwright API.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- playwright, python
- Domain
- api, testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100