Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 @playwright/test  





2 History  





3 Usage and Examples  





4 Reception  





5 References  





6 Further reading  





7 External links  














Playwright (software)







Add links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


Playwright
Developer(s)Microsoft
Initial releaseJanuary 31, 2020; 4 years ago (2020-01-31)[1]
Stable release

v1.40.1[2] / 28 November 2023; 7 months ago (2023-11-28)

Repositorygithub.com/microsoft/playwright
Written inTypeScript
Operating systemMicrosoft Windows, macOS, Linux
TypeSoftware testing framework for web applications
LicenseApache License 2.0
Websiteplaywright.dev

Playwright is an open-source automation library for browser testing and web scraping[3] developed by Microsoft[4][5] and launched on 31 January 2020, which has since become popular among programmers and web developers.

Playwright provides the ability to automate browser tasks in Chromium, Firefox and WebKit[6] with a single API. This allows developers to create reliable end-to-end tests that are capable of running in non-headless mode, as well as in headless mode for automation. Playwright has been compared to Cypress.[7]

Playwright supports programming languages like JavaScript, Python, C# and Java, though its main API was originally written in Node.js. It supports all modern web features including network interception and multiple browser contexts and provides automatic waiting, which reduces the flakiness of tests.

@playwright/test[edit]

@playwright/test is a test runner with Jest-like assertions[8] developed and maintained by the Playwright team that is built on top of the Playwright API. This test runner is tightly integrated with Playwright and is specifically designed for end-to-end testing.[9] It has capabilities like browser-specific tests, parallel test execution,[10] rich browser context options, snapshot testing, automatic retries and many more.

History[edit]

Playwright was announced by Microsoft in January 2020.[11] It was developed by a team of engineers who had previously worked on similar projects like Puppeteer at Google.[12] Since its inception, Playwright has been actively maintained and has seen rapid growth and adoption in the web testing community[13]

The @playwright/test runner was released later as part of an effort to provide a more comprehensive solution for browser-based testing. Its development was largely based on the need to have a specialized runner that can leverage the full potential of the Playwright API and make end-to-end testing more robust and straightforward.

Usage and Examples[edit]

Playwright is primarily used for automating browser tasks, which can range from simple page navigation and content scraping to more complex operations like automated form submissions, user interactions and more. For instance, a simple JavaScript code snippet using Playwright might look like:

const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  const page = await browser.newPage();
  await page.goto('https://example.com');
  await page.screenshot({ path: 'example.png' });
  await browser.close();
})();

In this example, Playwright is used to open a Chromium browser, navigate to 'https://example.com', take a screenshot and save it as 'example.png'.

@playwright/test further extends these capabilities by providing a test runner that allows developers to write and organize their tests in a more structured and scalable manner. An example test using @playwright/test might look like:

const { test } = require('@playwright/test');

test('basic test', async ({ page }) => {
  await page.goto('https://example.com');
  await expect(page).toHaveTitle('Example Domain');
});

In this example, a test is written to navigate to 'https://example.com' and check if the title of the page is 'Example Domain'.[14]

Reception[edit]

Both Playwright and @playwright/test have been well received by the developer community. They are praised for their robustness, speed and widely used in the industry, playing an important role in web application testing and development.

References[edit]

  1. ^ "v0.10.0 release". GitHub. Retrieved 1 June 2022.
  • ^ Tags · microsoft/playwright · GitHub
  • ^ Bansal, Mudit; Dar, Muhammad Ameen; Bhat, Moshin Manzoor; Sharma, Tushar; Uniyar, Rishita (2023). "Data Ingestion and Processing using Playwright". TechRxiv.
  • ^ Yegulalp, Serdar (30 September 2020). "Microsoft's Playwright simplifies tests for Python web apps". InfoWorld. IDG Communications. Retrieved 2 July 2023.
  • ^ Tung, Liam (1 October 2020). "Microsoft: Playwright for Python language lets you test web apps in all major browsers". ZDNET. Retrieved 2 July 2023.
  • ^ Judis, Stefan (22 October 2022). "Playwright, a Time-Saving End-to-End Testing Framework". The New Stack. Retrieved 2 July 2023.
  • ^ Tej, Krishna. "Playwright vs Cypress: A Comparison". BrowserStack. Retrieved 2 July 2023.
  • ^ "Assertions". Playwright. Microsoft. Retrieved 1 June 2023.
  • ^ "Library". Playwright. Microsoft. Retrieved 1 June 2023.
  • ^ "Parallelism and sharding". Playwright. Microsoft. Retrieved 1 June 2023.
  • ^ Attam, Arjun (30 September 2020). "Announcing Playwright for Python: Reliable end-to-end testing for the web". Microsoft DevBlogs. Microsoft. Retrieved 2 July 2023.
  • ^ Schiemann, Dylan (30 January 2020). "Microsoft Announces Playwright Alternative to Puppeteer". InfoQ. C4Media. Retrieved 2 July 2023.
  • ^ Gagan, Luc (1 July 2023). "A Comparative Analysis of Playwright Adoption vs Cypress and Selenium". Rayrun. Retrieved 2 July 2023.
  • ^ "toHaveTitle assertion". Playwright. Microsoft. Retrieved 1 June 2023.
  • Further reading[edit]

    External links[edit]


    Retrieved from "https://en.wikipedia.org/w/index.php?title=Playwright_(software)&oldid=1231838972"

    Categories: 
    Graphical user interface testing
    Free software testing tools
    Software using the Apache license
    Free and open-source software
    Microsoft free software
    2020 software
    Cross-platform free software
    Free software for Linux
    Free software for Windows
    Free software for macOS
    Free software programmed in TypeScript
    Hidden categories: 
    Articles with short description
    Short description matches Wikidata
     



    This page was last edited on 30 June 2024, at 14:55 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki