← Back to Discord Forum

How could simulate slow 3 g connection?

contextOptions: { // Emulate slow 3G connection emulateNetworkConditions: true, offline: false, downloadThroughput: 500 * 1024 / 8, // 500kbps uploadThroughput: 500 * 1024 / 8, // 500kbps latency: 150 // 150ms }, but get an error? Options used to create the context, as passed to browser.newContext([options]). Specific options like testOptions.viewport take priority over this

This thread is trying to answer question "How can I simulate a slow 3G connection without getting an error?"

0 replies


Simulating Slow Network with Playwright

You can simulate a slow network connection in Playwright using the slowMo option. This option slows down Playwright operations by the specified amount of milliseconds. It's a great way to see what's happening during test execution.

By default, slowMo is set to 0, meaning no delay between operations. But you can set it to a higher value to mimic a slower network. For instance, setting slowMo to 150 or 200 milliseconds can simulate a slow 3G connection.

Here's how you can use the slowMo option:

import { chromium } from 'playwright';

async function simulateSlow3G() {
  const browser = await chromium.launch();
  const context = await browser.newContext({
    slowMo: 150,
  const page = await context.newPage();
  await browser.close();


In this example, we've created a new context with slowMo set to 150 milliseconds. This introduces a delay of that duration between each operation on the page.

Remember, simulating network conditions can vary based on server response times and actual network conditions. For more tips on efficient Playwright test scripts, check out this blog post.

Related Discord Threads

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.