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

.NET 版 Playwright 附带用于编写端到端测试的 MSTest、NUnit、xUnit 和 xUnit v3 基类

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