Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

docs: explain that offline emulation does not affect WebRTC (#42624)

Pavel Feldman06c83c0debb3
diff --git a/docs/src/api/class-browsercontext.md b/docs/src/api/class-browsercontext.md
index 993a0d0e93..1aa95f63d8 100644
--- a/docs/src/api/class-browsercontext.md
+++ b/docs/src/api/class-browsercontext.md
@@ -1547,6 +1547,9 @@ Pass an array to use different credentials for different origins. The first entr
Whether to emulate network being offline for the browser context.
+:::note
+Offline emulation only affects requests that go through the browser's regular network stack, such as page navigations, `fetch()`, `XMLHttpRequest` and WebSockets. It does not affect WebRTC traffic: established `RTCPeerConnection`s keep sending and receiving media over UDP. To test WebRTC connection loss, interrupt the connection outside the browser, for example by stopping the TURN server or using an OS-level firewall.
+:::
## async method: BrowserContext.storageState
* since: v1.8
diff --git a/docs/src/emulation.md b/docs/src/emulation.md
index d05d07e6a2..7c3ca37c34 100644
--- a/docs/src/emulation.md
+++ b/docs/src/emulation.md
@@ -782,6 +782,11 @@ context = browser.new_context(
```csharp
var context = await browser.NewContextAsync(new() { Offline = true });
```
+
+:::note
+Offline emulation only affects requests that go through the browser's regular network stack, such as page navigations, `fetch()`, `XMLHttpRequest` and WebSockets. It does not affect WebRTC traffic: established `RTCPeerConnection`s keep sending and receiving media over UDP. To test WebRTC connection loss, interrupt the connection outside the browser, for example by stopping the TURN server or using an OS-level firewall.
+:::
+
## JavaScript Enabled
Emulate a user scenario where JavaScript is disabled.
diff --git a/packages/playwright-client/types/types.d.ts b/packages/playwright-client/types/types.d.ts
index d585c5a189..8c57503963 100644
--- a/packages/playwright-client/types/types.d.ts
+++ b/packages/playwright-client/types/types.d.ts
@@ -10601,6 +10601,12 @@ export interface BrowserContext {
/**
* @param offline Whether to emulate network being offline for the browser context.
+ *
+ * **NOTE** Offline emulation only affects requests that go through the browser's regular network stack, such as page
+ * navigations, `fetch()`, `XMLHttpRequest` and WebSockets. It does not affect WebRTC traffic: established
+ * `RTCPeerConnection`s keep sending and receiving media over UDP. To test WebRTC connection loss, interrupt the
+ * connection outside the browser, for example by stopping the TURN server or using an OS-level firewall.
+ *
*/
setOffline(offline: boolean): Promise<void>;
diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts
index d585c5a189..8c57503963 100644
--- a/packages/playwright-core/types/types.d.ts
+++ b/packages/playwright-core/types/types.d.ts
@@ -10601,6 +10601,12 @@ export interface BrowserContext {
/**
* @param offline Whether to emulate network being offline for the browser context.
+ *
+ * **NOTE** Offline emulation only affects requests that go through the browser's regular network stack, such as page
+ * navigations, `fetch()`, `XMLHttpRequest` and WebSockets. It does not affect WebRTC traffic: established
+ * `RTCPeerConnection`s keep sending and receiving media over UDP. To test WebRTC connection loss, interrupt the
+ * connection outside the browser, for example by stopping the TURN server or using an OS-level firewall.
+ *
*/
setOffline(offline: boolean): Promise<void>;