---
title: Playwright Options - Customize Playwright | TestingBot
description: Playwright options to customize the cloud-based runs for Playwright
source_url:
  html: https://testingbot.com/support/web-automate/playwright/options
  md: https://testingbot.com/support/web-automate/playwright/options/index.md
---
# Playwright Options

This page lists various options that you can use to customise your Playwright sessions on TestingBot.

The [Playwright Capabilities generator](https://testingbot.com/support/web-automate/playwright/capabilities) allows you to easily generate the necessary capabilities for your tests.

## Basic Settings

### Browser Name

The name of the browser to run your Playwright test on. TestingBot currently supports these browserNames:

- **Chrome**
- **Edge**
- **Firefox**
- **Safari (WebKit)**

[Chrome](https://testingbot.com#)[Edge](https://testingbot.com#)[Firefox](https://testingbot.com#)[WebKit](https://testingbot.com#)

    const capabilities = {
      'tb:options': {
        key: process.env.TB_KEY,
        secret: process.env.TB_SECRET
      },
      browserName: 'chrome',
      browserVersion: 'latest'
    }
    const browser = await playwright.chromium.connect({
      wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
    })

    const capabilities = {
      'tb:options': {
        key: process.env.TB_KEY,
        secret: process.env.TB_SECRET
      },
      browserName: 'edge',
      browserVersion: 'latest'
    }
    const browser = await playwright.chromium.connect({
      wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
    })

    const capabilities = {
      'tb:options': {
        key: process.env.TB_KEY,
        secret: process.env.TB_SECRET
      },
      browserName: 'firefox',
      browserVersion: 'latest'
    }
    const browser = await playwright.firefox.connect({
      wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
    })

    const capabilities = {
      'tb:options': {
        key: process.env.TB_KEY,
        secret: process.env.TB_SECRET
      },
      browserName: 'safari',
      browserVersion: 'latest'
    }
    const browser = await playwright.webkit.connect({
      wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
    })

### Browser Version

The version of the browser to run your Playwright test on.

  ![OS selected](https://testingbot.com/assets/environments/svg/windows11-0e1b28bc0fdd5034d3e4d3dc8d346c500a8c6522facf4b45d0da56537c1f1c6d.svg) Windows 11 › ![Browser selected](https://testingbot.com/assets/environments/svg/chrome-c4081ff447d2d898d4afcb8f074a907c960e6f007716c1a1d119eee6803c4042.svg) Chrome 139 

Loading environments...

Please wait while we load the available browsers and platforms.

    

Other Options:
- `"version": "*"` : If you use `*` as version, TestingBot will pick a random version. 
- `"version": "latest"` : TestingBot will automatically take the latest version. You can also use `latest-1`, `latest-2`, ... to test on the next most recent versions. For example, if the current latest Chrome version is 89 and you use `latest-2`, then the test will run on Chrome 87. 
- `"version": "<=16"` : TestingBot will pick a version smaller than or equal to the version you specify with `<=`.   
`"version": ">=16"` : TestingBot will pick a version higher than or equal to the version you specify with `>=`. 

### Browser Platform

The OS/platform for the test VM which will run the Playwright test.

    const pw = require('playwright-core')
    const capabilities = {
      'tb:options': {
        key: process.env.TB_KEY,
        secret: process.env.TB_SECRET
      },
      browserName: 'chrome',
      platform: 'WIN10'
    }
    const browser = await pw.chromium.connect({
      wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
    })

Possible values:
- `WIN11`
- `WIN10`
- `LINUX`
- `TAHOE`
- `SEQUOIA`
- `VENTURA`
- `MONTEREY`
- `BIGSUR`

### Make a video of your tests

By default we record a video of your test, which is accessible in the member area. If you do not wish to have this, you can disable it with this option. Video will not slow down your test considerably.

    const pw = require('playwright-core')
    const capabilities = {
      'tb:options': {
        key: process.env.TB_KEY,
        secret: process.env.TB_SECRET
      },
      browserName: 'chrome',
      browserVersion: 'latest',
      screenRecorder: false
    }
    await pw.chromium.connect({
      wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
    })

 Value Type | Default Value || boolean | `true` |

### Test Privacy

Make the test results for this test public so that everyone can access the results.

    const pw = require('playwright-core')
    const capabilities = {
      'tb:options': {
        key: process.env.TB_KEY,
        secret: process.env.TB_SECRET
      },
      browserName: 'chrome',
      browserVersion: 'latest',
      public: true
    }
    await pw.chromium.connect({
      wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
    })

 Value Type | Default Value || boolean | `false` |

### Blacklist hostnames

The hostnames you specify will be pointed to localhost instead of their real destination. This means you can speed up tests by blocking third party content which you don't need and slows down your test.

    const pw = require('playwright-core')
    const capabilities = {
      'tb:options': {
        key: process.env.TB_KEY,
        secret: process.env.TB_SECRET
      },
      browserName: 'chrome',
      browserVersion: 'latest',
      blacklist: 'site1.com,site2.com'
    }
    await pw.chromium.connect({
      wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
    })

 Value Type || string (comma-separated) |

### Customize Logging

By default, TestingBot records logs of all Playwright actions.

Set this option to `false` if you don't want TestingBot to record anything (for example, if you have sensitive data).

    const pw = require('playwright-core')
    const capabilities = {
      'tb:options': {
        key: process.env.TB_KEY,
        secret: process.env.TB_SECRET
      },
      browserName: 'chrome',
      browserVersion: 'latest',
      recordLogs: true
    }
    await pw.chromium.connect({
      wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
    })

 Value Type | Default Value | Possible Values: || boolean | `true` | `true`, `false` |

### Custom Time Zones

Change the Time Zone of the Virtual Machine to the Time Zone you specify. You can find a [list of timezones on Wikipedia](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). Only location names are supported (not their paths). See some examples below:

    const pw = require('playwright-core')
    const capabilities = {
      'tb:options': {
        key: process.env.TB_KEY,
        secret: process.env.TB_SECRET
      },
      browserName: 'chrome',
      browserVersion: 'latest',
      timeZone: 'Etc/UTC'
    }
    await pw.chromium.connect({
      wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
    })

 Value Type | Default Value | Possible Values: || string | "Etc/UTC" | [List of timezones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) |

### Change Screen Resolution

Will adjust the screen resolution before your test.

    const pw = require('playwright-core')
    const capabilities = {
      'tb:options': {
        key: process.env.TB_KEY,
        secret: process.env.TB_SECRET
      },
      browserName: 'chrome',
      browserVersion: 'latest',
      'screen-resolution': '1280x1024'
    }
    await pw.chromium.connect({
      wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
    })

 Value Type | Default Value | || string | "1280x1024" | 

 Platform | Resolutions || Windows/Linux | 

- 800x600 
- 1024x768 
- 1152x864 
- 1280x768 
- 1280x800 
- 1280x960 

- 1280x1024 
- 1400x1050 
- 1600x1200 
- 1680x1050 
- 1920x1080 
- 1920x1200 
- 2560x1440 

 |
| macOS | 

- 800x600
- 1024x768
- 1280x768
- 1280x800
- 1280x960

- 1280x1024
- 1366x768
- 1440x900
- 1600x900
- 1600x1200

- 1680x1050
- 1920x1080
- 1920x1200
- 2048x1536

 |

 |

### Geolocation Testing

We provide an option where you can specify from which country you'd like to run the test from.

Once you specify this option, the virtual machine we provision for your test will be configured to use a proxy in the country you specified.

    const pw = require('playwright-core')
    const capabilities = {
      'tb:options': {
        key: process.env.TB_KEY,
        secret: process.env.TB_SECRET
      },
      browserName: 'chrome',
      browserVersion: 'latest',
      geoCountryCode: 'US'
    }
    await pw.chromium.connect({
      wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
    })

We currently support the following country codes:

- **'\*'** : this will take a random country from the list below
- **'AU'** : Australia
- **'BE'** : Belgium
- **'BR'** : Brazil
- **'CA'** : Canada
- **'CL'** : Chile
- **'FR'** : France
- **'DE'** : Germany
- **'IN'** : India
- **'IT'** : Italy
- **'JP'** : Japan
- **'NO'** : Norway
- **'SG'** : Singapore
- **'ZA'** : South Africa
- **'SE'** : Sweden
- **'CH'** : Switzerland
- **'AE'** : United Arab Emirates
- **'GB'** : United Kingdom
- **'US'** : United States

### Upload

This option allows you to upload a file to the test VM running the Playwright test.   
 TestingBot will first download the file from the URL you specified and save it on the test VM so your test can use the file.

    const pw = require('playwright-core')
    const capabilities = {
      'tb:options': {
        key: process.env.TB_KEY,
        secret: process.env.TB_SECRET
      },
      browserName: 'chrome',
      browserVersion: 'latest',
      upload: 'https://testingbot.com/assets/logo-head.png',
      uploadFilepath: '/tmp/test.log'
    }
    await pw.chromium.connect({
      wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
    })
    
    const page = await browser.newPage()
    await page.goto('http://localhost:3000')
    await page.locator('input[name="file-upload"]').click()
    await page.locator('input[name="file-upload"]').setInputFiles('/tmp/test.png')
    await page.click('upload-button')
    await browser.close()

You need to specify both the download URL as `upload` and use `uploadFilepath` to indicate where TestingBot needs to put the file. We recommend using these directories to save your files: For Windows (`C:\test\`), for Linux/macOS: (`/tmp/`).

### Change Playwright Version

By default, TestingBot will use the same Playwright version as the one that is running your test. If for some reason you need to specify a different version, you can use the `playwrightVersion` option.

    const pw = require('playwright-core')
    const capabilities = {
      'tb:options': {
        key: process.env.TB_KEY,
        secret: process.env.TB_SECRET
      },
      'playwright:options': {
      	playwrightVersion: '1.54.1'
      },
      browserName: 'chrome',
      browserVersion: 'latest',
      name: 'First Test'
    }
    await pw.chromium.connect({
      wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
    })

### Change Test Name

Add a name to this test, which will show up in our member area and API.

    const pw = require('playwright-core')
    const capabilities = {
      'tb:options': {
        key: process.env.TB_KEY,
        secret: process.env.TB_SECRET
      },
      browserName: 'chrome',
      browserVersion: 'latest',
      name: 'First Test'
    }
    await pw.chromium.connect({
      wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
    })

 Value Type | Default Value || string | unnamed test |

### Group Tests

A key you can use to group certain tests in the same build (for example in Jenkins).   
 The builds will appear in our member area.

    const pw = require('playwright-core')
    const capabilities = {
      'tb:options': {
        key: process.env.TB_KEY,
        secret: process.env.TB_SECRET
      },
      browserName: 'chrome',
      browserVersion: 'latest',
      build: 'First Build'
    }
    await pw.chromium.connect({
      wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
    })

 Value Type || string |

### Timeout

Control the timeout setting of the session. This setting, specified in seconds, controls when a session times out.

A timeout occurs when a session has not received any commands from your Playwright test for the xx amount of seconds specified.   
 If a certain Playwright command takes longer than the specified setting, the session will automatically close.

    const pw = require('playwright-core')
    const capabilities = {
      'tb:options': {
        key: process.env.TB_KEY,
        secret: process.env.TB_SECRET,
      	timeout: 90
      },
      browserName: 'chrome',
      browserVersion: 'latest'
    }
    await pw.chromium.connect({
      wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
    })

 Value Type | Default Value || int (specify number of seconds) | 90 seconds |

### Maximum Test Duration

The maximum duration for a single test. This is a safeguard to prevent bad tests from using up your credits.

We generally recommend to keep tests short (less than 10 minutes). It's better to split up large tests in smaller individual tests.   
 This keeps your tests fast and allows for more parallelization of your tests.

    const pw = require('playwright-core')
    const capabilities = {
      'tb:options': {
        key: process.env.TB_KEY,
        secret: process.env.TB_SECRET
      },
      browserName: 'chrome',
      browserVersion: 'latest',
      maxduration: 1800
    }
    await pw.chromium.connect({
      wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
    })

 Value Type | Default Value || int (specify number of seconds) | 1800 seconds (30 minutes) |

### Custom Metadata

Send along custom data, for example your release, server, commit hash, ...   
 This will show up on the test detail page in the TestingBot member area.

    const pw = require('playwright-core')
    const capabilities = {
      'tb:options': {
        key: process.env.TB_KEY,
        secret: process.env.TB_SECRET
      },
      browserName: 'chrome',
      browserVersion: 'latest',
      extra: 'Extra Information'
    }
    await pw.chromium.connect({
      wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
    })

 Value Type || string |

### Startup Flags

You can customize the startup flags of the browser by passing in extra flags.

This is identical to passing `args` with Playwright.

    const pw = require('playwright-core')
    const startupFlags = []
    startupFlags.push('--window-size=1280,720')
    startupFlags.push('--hide-scrollbars')
    
    const browser = await pw.chromium.connect({
      wsEndpoint: `wss://cloud.testingbot.com` + 
      `/playwright?key=api_key&secret=api_secret&browserName=chrome&startupFlags=${JSON.stringify(startupFlags)}`
    })
    
    const page = await browser.newPage()
    await page.goto('https://testingbot.com')
    await browser.close()

### TestingBot Tunnel

You can specify the `tunnelIdentifier` to [use Playwright with TestingBot Tunnel](https://testingbot.com/support/web-automate/playwright#tunnel).

    const pw = require('playwright-core')
    
    (async () => {
      const capabilities = {
        'tb:options': {
          key: process.env.TB_KEY,
          secret: process.env.TB_SECRET
        },
        browserName: 'chrome',
        browserVersion: 'latest',
        tunnelIdentifier: 'myPlaywrightTunnel'
      }
      const browser = await pw.chromium.connect({
        wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
      })
      const context = await browser.newContext()
      const page = await context.newPage()
    
      await page.goto('http://localhost:3000/')
      await page.screenshot({ path: 'screenshot.png' })
    
      await browser.close()
    })()

By default we support proxying these ports for localhost testing: `[443, 80, 8080, 3030, 3000, 3001, 3400]`.   
 If you need additional ports, please pass an array of port numbers to either `localHttpPorts` or `localHttpsPorts`

### Firefox Preferences

You can pass in the [firefoxPreferences](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-firefox-user-prefs) which Playwright accepts.

    const pw = require('playwright-core')
    
    (async () => {
      const capabilities = {
        'tb:options': {
          key: process.env.TB_KEY,
          secret: process.env.TB_SECRET
        },
        'playwright:options': {
        	firefoxPreferences: ''
        },
        browserName: 'firefox',
        browserVersion: 'latest'
      }
      await pw.firefox.connect({
        wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
      })
    })()

### Devtools

You can pass in the [devTools](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-devtools) which Playwright accepts. This is a Chromium-only option which decides whether to auto-open a Developer Tools panel for each tab during the test.

    const pw = require('playwright-core')
    
    (async () => {
      const capabilities = {
        'tb:options': {
          key: process.env.TB_KEY,
          secret: process.env.TB_SECRET
        },
        'playwright:options': {
        	devtools: true
        },
        browserName: 'chrome',
        browserVersion: 'latest'
      }
      await pw.chromium.connect({
        wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
      })
    })()

### Patchright

Patchright is a modified version of Playwright that tries to avoid detection by anti-bot systems. It patches several leaks, which are used by anti-scraper systems to detect Playwright automation.

You can use Patchright with TestingBot, by passing in the `patchRightVersion` option, specifying the version of Patchright you want to use.

    const pw = require('playwright-core')
    
    (async () => {
      const capabilities = {
        'tb:options': {
          key: process.env.TB_KEY,
          secret: process.env.TB_SECRET
        },
        'playwright:options': {
        	patchRightVersion: '1.52.5'
        },
        browserName: 'chrome',
        browserVersion: 'latest'
      }
      await pw.chromium.connect({
        wsEndpoint: `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
      })
    })()

Was this page helpful? Yes No 

## Looking for More Help?

Have questions or need more information?   
 You can reach us via the following channels:

- [Email us](https://testingbot.com/contact/new)
- [Join our Slack Channel](https://join.slack.com/t/testingb0t/shared_invite/zt-3bcw9xch-jk19~6XPs_xBrsAgAedkCw)
