---
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/index.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.

    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()

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.

    const firefoxPrefs = {
    	'browser.autoFocus': true
    }
    
    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).

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)
