---
title: Playwright Testing on TestingBot | TestingBot Blog
description: Learn how Playwright can run your automated tests on a variety of browsers,
  local or remote browsers on TestingBot.
source_url:
  html: https://testingbot.com/blog/playwright-testing-introduction
  md: https://testingbot.com/blog/playwright-testing-introduction.md
---

# Introduction to Playwright Testing

Learn how Playwright can run your automated tests on a variety of browsers, local or remote browsers on TestingBot.

By [Jochen D.](https://testingbot.com/about/jochen-d)2023-06-22

 Share on Facebook 

 Share on Twitter 

 Post on Reddit 

 Share link 

Playwright is a powerful open-source testing framework, maintained by Microsoft. It is perfect for end-to-end automated testing of websites.It provides support for multiple browsers and has libraries for multiple programming languages.

The framework offers an extensive set of tools and features, allowing you to run automated tests against websites on the following browsers:

- Chrome (Chromium)
- Firefox
- WebKit
- Microsoft Edge (Chromium)

## Should you choose Playwright over Selenium or Puppeteer?

Generally, Playwright will be faster to run automated tests than Selenium. One of the reasons is that Playwright uses a protocol based on Websockets, while Selenium uses multiple HTTP(s) requests during a single test run, the so-called WebDriver API.

While Playwright offers support for multiple browsers, it is unable to automate Safari. Instead, Playwright comes bundled with a custom version of WebKit (the engine behind Safari). Selenium on the other hand is capable of automating Safari, through the use of SafariDriver.

Below is a handy overview, allowing you to compare the advantages and disadvantages regarding Selenium vs Playwright.

 Feature | Playwright | Selenium || Supported Browsers | Chome, Firefox, Microsoft Edge and WebKit | Chrome, Firefox, Microsoft Edge, IE, Opera and Safari |
| Programming Languages | Java, Python, C#, TypeScript and JavaScript | Java, Python, C#, Ruby, Perl, PHP and JavaScript |
| Real Devices Supported | Experimental Android support | iOS and Android devices (through Appium) |
| License | Open-Source | Open-Source |

## What can you do with Playwright that is not possible with Selenium?

### Network Interception

Playwright allows you to [mock network traffic](https://playwright.dev/docs/mock): you can intercept HTTP(s) requests and change their response. This makes it easy to test various scenarios in your app, for example what would happen if the response contains an error, etc.

Selenium is working on adding [Network Interception](https://www.selenium.dev/documentation/webdriver/bidi/network/) through the use of [WebDriver BiDirectional Protocol](https://w3c.github.io/webdriver-bidi/), but at the time of this writing this is not fully functional yet.

### Visual Comparison

Playwright Test provides [Visual Comparison](https://playwright.dev/docs/test-snapshots) support. This means you can take a base/golden screenshot and compare future screenshots to detect changes. Snapshots are also supported by Playwright Test, allowing you to compare text and binary content.

Selenium does not provide this functionality out of the box. If you want to do this with Selenium, you would need to use a test framework for this, such as WebDriverIO.

### Test Downloads

Playwright offers the ability to [test file downloads](https://playwright.dev/docs/downloads). During a test, you might want to test the download functionality of your app. You can fetch the download url, file system path and payload stream using the Download object from the event emitted by Playwright.

Selenium does not offer this functionality. If you want to do this with Selenium, TestingBot provides the ability to [Test File Downloads with Selenium](https://testingbot.com/support/web-automate/selenium/test-file-downloads).

### API Testing

[API Testing](https://playwright.dev/docs/api-testing) is a feature implemented in Playwright Test. This gives you the possibility to write API tests to test REST-API services. You can even [send API requests during your UI tests](https://playwright.dev/docs/api-testing#sending-api-requests-from-ui-tests).

This might come in handy when you need to set up a specific state in your API before you start your tests.

## Setting up and running your first Playwright Test

To get started with Playwright Test, you can install the package:

```bash
npm i -D @playwright/test
```

Next, you will need to create a [configuration file](https://testingbot.com/support/web-automate/playwright/playwright-test#configuration), similar to the example below.

```javascript
import { defineConfig } from '@playwright/test'
import { getCdpEndpoint } from './testingbot.config'

/**
 * See https://playwright.dev/docs/test-configuration.
 */
export default defineConfig({

  testDir: './tests',

  /* Maximum time one test can run for. */
  timeout: 30 * 1000,

  /* Fail the build on CI if you accidentally left test.only in the source code. */
  forbidOnly: !!process.env.CI,

  /* Retry on CI only */
  retries: process.env.CI ? 2 : 0,

  /* Opt out of parallel tests on CI. */
  workers: process.env.CI ? 1 : undefined,

  /* Reporter to use. See https://playwright.dev/docs/test-reporters */
  reporter: 'html',

  /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
  use: {
    /* Base URL to use in actions like `await page.goto('/')`. */
    // baseURL: 'http://localhost:3000',

    /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
    trace: 'on-first-retry',
  },

  projects: [
    {
      name: 'playwright-chrome@latest:Windows 10',
      use: {
        connectOptions: { 
          wsEndpoint: getCdpEndpoint({
            browserName: 'chrome',
            browserVersion: 'latest',
            platform: 'WIN10'
          }) 
        }
      },
    }
  ]
})
```

Also create a file called `testingbot.config.js` which contains:

```javascript
exports.getCdpEndpoint = (userCapabilities) => {
    const defaultCapabilities = {
        'tb:options': {
            key: process.env.TB_KEY,
            secret: process.env.TB_SECRET
        }
    }
    const capabilities = Object.assign(userCapabilities, defaultCapabilities)
    const cdpUrl = `wss://cloud.testingbot.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
    return cdpUrl
}
```

All that's left is to create a simple test, which will navigate to the Playwright website, click a link and verify the URL:

```javascript
test('Sample TestingBot test', async ({ page }) => {
  await page.goto('https://playwright.dev/');

  // Click the get started link.
  await page.getByRole('link', { name: 'Get started' }).click();

  // Expects the URL to contain intro.
  await expect(page).toHaveURL(/.*intro/);
})
```

To run the test, you can now execute this command:

```bash
npx playwright test
```

## Playwright Testing with TestingBot

TestingBot provides a remote grid of browsers, capable to run Playwright tests on all browsers supported by Playwright.

For each test you run, TestingBot will collect a video, screenshots and logs.

For more information, please see the TestingBot [Playwright Test Documentation](https://testingbot.com/support/web-automate/playwright/playwright-test).

[← Previous post Test on Safari Tech Preview and Safari beta](https://testingbot.com/blog/safari-tech-preview-beta) [Next post → Test on macOS Sonoma](https://testingbot.com/blog/macos-sonoma-testing)

## Sidebar

### TestingBot Cloud Testing

Run automated, manual and visual tests on remote browsers and devices. Sign up for a free trial.

[Free Trial](https://testingbot.com/users/sign_up)

### Latest articles

[![Announcing AI Test Insights](https://testingbot.com/assets/blog/2026/ai-insights.jpg)](https://testingbot.com/blog/ai-test-insights)

#### Announcing AI Test Insights

Use AI Insights to quickly discover why an automated test...

[Read: Announcing AI Test Insights](https://testingbot.com/blog/ai-test-insights)

[![Selenium vs Playwright 2026](https://testingbot.com/assets/blog/2026/selenium-vs-playwright-2026.jpg)](https://testingbot.com/blog/selenium-vs-playwright)

#### Selenium vs Playwright 2026

Comparing Selenium vs Playwright - which is the best test...

[Read: Selenium vs Playwright 2026](https://testingbot.com/blog/selenium-vs-playwright)

[![Maestro Physical Device Testing](https://testingbot.com/assets/blog/2026/maestro-physical.jpg)](https://testingbot.com/blog/maestro-physical-device-testing)

#### Maestro Physical Device Testing

Maestro testing in parallel on physical Android and iOS d...

[Read: Maestro Physical Device Testing](https://testingbot.com/blog/maestro-physical-device-testing)

## Related Articles

[![Selenium vs Playwright 2026](https://testingbot.com/assets/blog/2026/selenium-vs-playwright-2026.jpg)](https://testingbot.com/blog/selenium-vs-playwright "Selenium vs Playwright 2026")

### [Selenium vs Playwright 2026](https://testingbot.com/blog/selenium-vs-playwright)

Comparing Selenium vs Playwright - which is the best test framework for your usecase?

[Read article →](https://testingbot.com/blog/selenium-vs-playwright)

[![Selenium 20th birthday](https://testingbot.com/assets/blog/2024/selenium20.webp)](https://testingbot.com/blog/selenium-20-years "Selenium 20th birthday")

### [Selenium 20th birthday](https://testingbot.com/blog/selenium-20-years)

Celebrate Selenium's 20th birthday. An overview of the years.

[Read article →](https://testingbot.com/blog/selenium-20-years)

[![Announcing AI Test Insights](https://testingbot.com/assets/blog/2026/ai-insights.jpg)](https://testingbot.com/blog/ai-test-insights "Announcing AI Test Insights")

### [Announcing AI Test Insights](https://testingbot.com/blog/ai-test-insights)

Use AI Insights to quickly discover why an automated test failed.

[Read article →](https://testingbot.com/blog/ai-test-insights)

[![tvOS Physical Device Testing](https://testingbot.com/assets/blog/2025/appletv.jpg)](https://testingbot.com/blog/tvos-automated-testing "tvOS Physical Device Testing")

### [tvOS Physical Device Testing](https://testingbot.com/blog/tvos-automated-testing)

Run automated tvOS tests on physical AppleTV devices.

[Read article →](https://testingbot.com/blog/tvos-automated-testing)

## More by Jochen D.

[![Announcing AI Test Insights](https://testingbot.com/assets/blog/2026/ai-insights.jpg)](https://testingbot.com/blog/ai-test-insights "Announcing AI Test Insights")
### [Announcing AI Test Insights](https://testingbot.com/blog/ai-test-insights)

Use AI Insights to quickly discover why an automated test failed.

[![Maestro Physical Device Testing](https://testingbot.com/assets/blog/2026/maestro-physical.jpg)](https://testingbot.com/blog/maestro-physical-device-testing "Maestro Physical Device Testing")
### [Maestro Physical Device Testing](https://testingbot.com/blog/maestro-physical-device-testing)

Maestro testing in parallel on physical Android and iOS devices.

[![tvOS Physical Device Testing](https://testingbot.com/assets/blog/2025/appletv.jpg)](https://testingbot.com/blog/tvos-automated-testing "tvOS Physical Device Testing")
### [tvOS Physical Device Testing](https://testingbot.com/blog/tvos-automated-testing)

Run automated tvOS tests on physical AppleTV devices.

[See all posts by Jochen D. →](https://testingbot.com/about/jochen-d)

## Ready to start testing?
[Start a free trial](https://testingbot.com/users/sign_up)
