microsoft / microsoft/playwright

Chromium: page born into setOffline(true) context keeps navigator.onLine === true (1.62.0)

Open
#42,174 1 comment 0 reactions 1 assignee View on GitHub

@dgozman is already working on this.

Since Aug 17, 2026.

v1.64
Dominant language
TypeScript
Stars
96.3k
Forks
6.5k
Avg merge
1d 6h
Merged PRs (30d)
180

Description

## Summary

In Playwright **1.62.0**, a page created on a BrowserContext that is already offline (`context.setOffline(true)` before `newPage()`) reports `navigator.onLine === true` from the first script and never receives an `offline` event. **1.61.1** correctly reports `onLine === false`.

Toggle-offline on an already-open page works in both versions.

## Minimal repro

```js
const { chromium } = require('@playwright/test');

(async () => {
const browser = await chromium.launch();
const context = await browser.newContext();
await context.setOffline(true);
const page = await context.newPage();
const probe = await page.evaluate(() => ({
initOnLine: navigator.onLine,
}));
console.log(probe); // 1.62.0: { initOnLine: true } — wrong
// 1.61.1: { initOnLine: false } — correct
await browser.close();
})();
```

## Context

Filed from Pyrenza (LIFTV-2200) after LIFTV-2189 adjudication. We currently pin `@playwright/test` at `1.62.1` in two package.json locations; confirming whether 1.62.1 still reproduces or if a later fix landed.

Nearest prior art mentioned: microsoft/playwright#34402.

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.