Integrating with Playwright
How to use Playwright with Airtop
Playwright is a powerful automation library that allows you to control headless browsers. Airtop provides a Playwright connector that allows you to use Playwright to automate your browser.
Installation
You will need to install the playwright-core
package to use Playwright with Airtop.
Usage
Once you have created a session with Airtop, you can use the Playwright library to control the browser by connecting Playwright to the CDP endpoint provided by Airtop. Please note that currently, Airtop only supports using the default browser context.
If you’re not already familiar with Playwright, you might want to check out their documentation to learn more about the library and its capabilities.
Combining Playwright and Airtop Window Management
You can use Airtop’s window management functions in combination with Playwright to automate your browser. For example, you might want to create a new window, load a URL in it, use our AI APIs, but use Playwright to push a few buttons on the page.
Once you create a window, you’ll be given a window ID, which you’ll use to interact with the window using Airtop’s SDK. But you’ll also be given a targetId
, which you’ll use to connect Playwright to the window.
Common Errors
Here are some common errors you might encounter when using Playwright with Airtop when you initially connect to the CDP endpoint: