- Jul 14, 2026
- admin
- 0

Playwright APIs
One of Playwright’s biggest strengths is that Microsoft has built a very rich API. Instead of relying on third-party libraries, Playwright provides hundreds of built-in methods covering almost every browser automation scenario.
Here are the major categories:
| Category | Examples |
| Browser | chromium.launch(), browser.close() |
| BrowserContext | newContext(), cookies(), addCookies(), storageState() |
| Page | goto(), reload(), goBack(), waitForURL() |
| Locators | locator(), getByRole(), getByText(), getByLabel() |
| Element Actions | click(), fill(), check(), hover(), dragTo() |
| Assertions | toHaveText(), toBeVisible(), toHaveTitle() |
| Network | route(), waitForResponse(), request.fetch() |
| API Testing | request.get(), post(), put(), delete() |
| Frames | frameLocator(), frame() |
| Popups | waitForEvent(‘popup’) |
| Downloads | waitForEvent(‘download’) |
| File Upload | setInputFiles() |
| Screenshots | screenshot() |
| Videos | Video recording |
| Tracing | context.tracing.start() |
| Storage | Cookies, Local Storage, Session Storage, Storage State |
| Keyboard | press(), type(), down(), up() |
| Mouse | move(), click(), wheel() |
| Touch | tap() |
| Dialogs | accept(), dismiss() |
| Permissions | grantPermissions() |
| Geolocation | setGeolocation() |
| Emulation | Mobile devices, viewport, timezone, locale |
| Authentication | HTTP Auth, Storage State |
| Parallel Execution | Workers, Projects |
| Reporting | HTML, JSON, JUnit reporters |
| Fixtures | Built-in and custom fixtures |
| Hooks | beforeAll, beforeEach, afterEach, afterAll |
Approximately how many APIs?
Playwright exposes hundreds of methods across its main classes. Some of the key classes include:
- Browser
- BrowserContext
- Page
- Locator
- Frame
- ElementHandle
- APIRequestContext
- Request
- Response
- Download
- Dialog
- FileChooser
- Keyboard
- Mouse
- Touchscreen
- Tracing
- Video
- Worker
- Clock (introduced in recent versions)
The Page and Locator classes alone provide dozens of methods each.
Why Playwright became popular
Microsoft designed Playwright to minimize the need for external libraries. Features such as:
- Auto-waiting
- Smart locators
- Multiple browser support
- API testing
- Network mocking
- Parallel execution
- Authentication reuse
- Mobile emulation
- Trace Viewer
are all included out of the box.
For more Playwright tutorials, examples, and automation concepts, visit our Playwright Tutorial section.

