---
title: Set browser options for Playwright tests | TestingBot
description: 'Configure browser options for Playwright tests on TestingBot: headless
  mode, browser channel, viewport, locale, timezone, user agent and more, all via
  tb:options capabilities on the WebSocket endpoint.'
source_url:
  html: https://testingbot.com/support/web-automate/playwright/change-browser-options
  md: https://testingbot.com/support/web-automate/playwright/change-browser-options.md
---

# Browser Options

This document will guide you in specifying custom browser options, which can be used with Playwright testing.

You can change the browser start arguments for a Chromium-based browser, or pass user-preferences for the Firefox browser.

## Set args for Chromium browsers

In the example below we'll set custom browser `args` which will be used by the browser upon startup.

```javascript
const pw = require('playwright-core')

const startupFlags = []
startupFlags.push('--window-size=1280,720')
startupFlags.push('--hide-scrollbars')

;(async () => {
  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()
})()
```

You can use any of the [Chromium commandline switches](https://peter.sh/experiments/chromium-command-line-switches/).

## Set Firefox user preferences

If you are running a Playwright test on Firefox, you can set the Firefox User Preferences.

```javascript
const pw = require('playwright-core')

const firefoxPrefs = {
	'browser.autoFocus': true
}

;(async () => {
  const browser = await pw.firefox.connect({
    wsEndpoint: `wss://cloud.testingbot.com/playwright` +
    `?key=api_key&secret=api_secret&browserName=firefox&firefoxUserPrefs=${JSON.stringify(firefoxPrefs)}`
  })

  const page = await browser.newPage()
  await page.goto('https://testingbot.com')
  await browser.close()
})()
```

For more information, please see [Firefox Preferences](https://support.mozilla.org/en-US/kb/about-config-editor-firefox).

### Looking for more help?

Have questions or need more information? Reach out via email or Slack.

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