From f1b825e6a2065aa3db99012c1a57843a27ed30a3 Mon Sep 17 00:00:00 2001 From: Arjun Attam Date: Tue, 7 Jan 2020 11:51:22 -0800 Subject: [PATCH] docs: basic readme (#403) --- README.md | 38 +++++++++++++++++++++++++++++++++++++- package.json | 2 +- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b81a84e564..5caa19f757 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,41 @@ +# Playwright -# Contributing +[![npm version](https://badge.fury.io/js/playwright.svg)](https://badge.fury.io/js/playwright) + +Playwright is a Node library to automate web browsers (Chromium, Webkit and Firefox). + +## Getting started + +### Installation + +``` +npm i playwright +``` + +### Usage + +Playwright can be used to create a browser instance, open pages, and then manipulate them. See [API docs](https://github.com/microsoft/playwright/blob/master/docs/api.md) for a comprehensive list. + +#### Example + +This code snippet navigates to example.com in the Webkit browser, and saves a screenshot. + +```js +const pw = require('playwright'); + +(async () => { + const browser = await pw.playwright('webkit').launch(); // or 'chromium', 'firefox' + const context = await browser.newContext(); + const page = await context.newPage(); + + await page.goto('https://www.example.com/'); + await page.screenshot({ path: 'example.png' }); + + await browser.close(); +})(); +``` + +## Contributing This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us diff --git a/package.json b/package.json index ecc30753f3..0634835152 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "playwright", "version": "0.9.9-post", - "description": "A high-level API to control web browsers", + "description": "A high-level API to automate web browsers", "repository": "github:Microsoft/playwright", "engines": { "node": ">=10.17.0"