Skip to main content

支持的语言

介绍

Introduction

Playwright 可用于共享相同底层实现的多种语言。所有语言都支持自动化浏览器的所有核心功能,而测试生态系统集成则不同。根据你的经验、对其测试生态系统的熟悉程度以及你的项目限制来选择语言。为了获得最佳体验,请选择我们为每种语言推荐的测试运行程序。

Playwright is available in multiple languages that share the same underlying implementation. All core features for automating the browser are supported in all languages, while testing ecosystem integration is different. Pick the language based on your experience, familiarity with its testing ecosystem and your project constraints. For the best experience pick the test runner that we recommend for each language.

JavaScript 和 TypeScript

JavaScript and TypeScript

Node.js 的 Playwright 附带了自己的 测试运行器,它提供了出色的并行化机制、屏幕截图断言、html 报告器、自动跟踪等。

Playwright for Node.js comes with its own test runner that provides great parallelization mechanism, screenshot assertions, html reporter, automatic tracing etc.

Python

Playwright pytest 插件 是运行端到端测试的推荐方法。它提供上下文隔离,可以在多个浏览器配置上运行,并且可以开箱即用。

Playwright Pytest plugin is the recommended way to run end-to-end tests. It provides context isolation, running it on multiple browser configurations and more out of the box.

Java

你可以根据你的项目需求选择任何测试框架,例如 JUnit 或 TestNG。

You can choose any testing framework such as JUnit or TestNG based on your project requirements.

.NET

Playwright for .NET 附带 NUnit 基类MSTest 基类,用于编写端到端测试。

Playwright for .NET comes with NUnit base classes and MSTest base classes for writing end-to-end tests.