MarketSquare / MarketSquare/robotframework-browser

Add `timeout=`/`wait_until=` to `Go Back` and `Go Forward`, and `referer=` to `Go To`

Open
#5,111 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

Two small consistency gaps in the navigation keywords:

1. **`Go Back` / `Go Forward` take no arguments at all.** `Go To` and `Reload` let users control how long to wait and which load state counts as "done" (`load`, `domcontentloaded`, `networkidle`, `commit`), but history navigation always uses the defaults. On slow pages this makes back/forward navigation flaky with no remedy — users resort to adding `Wait For Load State` or sleeps after every `Go Back`.

2. **`Go To` cannot set a referer.** Testing referrer-dependent server behavior (analytics attribution, hotlink protection, referer-based redirects) currently requires setting a context-wide `Referer` header via `New Context httpHeaders=`, which then wrongly applies to *every* request in the context instead of the one navigation.

## Proposed keyword / arguments

New named-only arguments on the existing keywords:

```
Go Back *, timeout=None wait_until=load
Go Forward *, timeout=None wait_until=load
Go To url timeout=None wait_until=load *, referer=None
```

- `timeout` — maximum navigation time (Robot Framework time format); defaults to the library timeout, same as `Go To`.
- `wait_until` — same `PageLoadStates` enum and default as `Go To`/`Reload`.
- `referer` — value of the `Referer` header for this one navigation; takes precedence over a context-wide header for this request only.

```robotframework
Go To ${DEEP_LINK} wait_until=networkidle
Go Back timeout=30s wait_until=domcontentloaded
Get Url == ${START_URL}
Go Forward wait_until=networkidle

Go To ${LANDING_PAGE} referer=https://partner.example.com/campaign
Get Text id=attribution == partner.example.com
```

## Playwright API

- [page.goBack](https://playwright.dev/docs/api/class-page#page-go-back) / [page.goForward](https://playwright.dev/docs/api/class-page#page-go-forward) (options `timeout`, `waitUntil`)
- [page.goto `referer` option](https://playwright.dev/docs/api/class-page#page-goto-option-referer)

## Implementation notes

- `protobuf/playwright.proto`: `GoBack`/`GoForward` currently take `Request.Empty` — switch to an options message carrying timeout and waitUntil; add a `referer` field to the `UrlOptions` used by `GoTo`.
- `node/playwright-wrapper`: pass the options through to `page.goBack()`/`page.goForward()`/`page.goto()`.
- Python: extend `go_back`, `go_forward`, `go_to` in `Browser/keywords/browser_control.py`; docs; stub regen; atest using the test app's redirect/slow pages, plus a referer-echo assertion.

## Backwards compatibility

Additive named-only arguments. Defaults (`timeout=None` → library timeout, `wait_until=load`, `referer=None` → no header) reproduce today's behavior exactly.

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.