diff --git a/.gitignore b/.gitignore
index 3d0c2d5b9d..589960ef12 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,7 +18,6 @@ yarn.lock
/src/chromium/protocol.ts
/src/firefox/protocol.ts
/src/webkit/protocol.ts
-/utils/browser/playwright-web.js
lib/
playwright-*.tgz
/web.js
diff --git a/.npmignore b/.npmignore
index 037bf682a9..6b7ce811a4 100644
--- a/.npmignore
+++ b/.npmignore
@@ -9,7 +9,7 @@ lib/injected/
#types
!lib/**/*.d.ts
!index.d.ts
-!web.d.ts
+
# Install
!install.js
@@ -18,12 +18,3 @@ lib/injected/
# root for "playwright/web"
!web.js
-
-# specific browsers
-!chromium.js
-!firefox.js
-!webkit.js
-
-# dgozman says to remove these
-!DeviceDescriptors.js
-!Errors.js
diff --git a/DeviceDescriptors.js b/DeviceDescriptors.js
deleted file mode 100644
index 5b4ab87e1c..0000000000
--- a/DeviceDescriptors.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * Copyright 2019 Google Inc. All rights reserved.
- * Modifications copyright (c) Microsoft Corporation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-const {DeviceDescriptors} = require('./lib/deviceDescriptors');
-
-module.exports = DeviceDescriptors;
diff --git a/Errors.js b/Errors.js
deleted file mode 100644
index 5475d2223d..0000000000
--- a/Errors.js
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * Copyright 2018 Google Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-module.exports = require('./lib/errors');
diff --git a/README.md b/README.md
index e76b23e78d..d4d3b86a50 100644
--- a/README.md
+++ b/README.md
@@ -31,7 +31,7 @@ This code snippet navigates to example.com in WebKit, and saves a screenshot.
const pw = require('playwright');
(async () => {
- const browser = await pw.playwright('webkit').launch(); // or 'chromium', 'firefox'
+ const browser = await pw.webkit.launch(); // or 'chromium', 'firefox'
const context = await browser.newContext();
const page = await context.newPage();
@@ -50,7 +50,7 @@ This code snippet navigates to example.com in Firefox, and executes a script in
const pw = require('playwright');
(async () => {
- const browser = await pw.playwright('firefox').launch(); // or 'chromium', 'webkit'
+ const browser = await pw.firefox.launch(); // or 'chromium', 'webkit'
const context = await browser.newContext();
const page = await context.newPage();
diff --git a/chromium.js b/chromium.js
deleted file mode 100644
index d0e27ffbf6..0000000000
--- a/chromium.js
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * Copyright 2017 Google Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-module.exports = require('./index').playwright('chromium');
diff --git a/docs/api.md b/docs/api.md
index 287cf76643..c5438745c6 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -300,7 +300,7 @@
Playwright module provides a method to launch a browser instance.
The following is a typical example of using Playwright to drive automation:
```js
-const playwright = require('playwright')('chromium'); // Or 'firefox' or 'webkit'.
+const playwright = require('playwright').chromium; // Or 'firefox' or 'webkit'.
(async () => {
const browser = await playwright.launch();
@@ -329,7 +329,7 @@ Returns a list of devices to be used with [`page.emulate(options)`](#pageemulate
devices can be found in [lib/deviceDescriptors.js](https://github.com/Microsoft/playwright/blob/master/src/deviceDescriptors.ts).
```js
-const playwright = require('playwright')('firefox'); // Or 'chromium' or 'webkit'.
+const playwright = require('playwright').firefox; // Or 'chromium' or 'webkit'.
const iPhone = playwright.devices['iPhone 6'];
(async () => {
@@ -376,7 +376,7 @@ A Browser is created when Playwright connects to a browser instance, either thro
An example of using a [Browser] to create a [Page]:
```js
-const playwright = require('playwright');
+const playwright = require('playwright').firefox; // Or 'chromium' or 'webkit'.
(async () => {
const browser = await playwright.launch();
@@ -388,7 +388,7 @@ const playwright = require('playwright');
An example of disconnecting from and reconnecting to a [Browser]:
```js
-const playwright = require('playwright');
+const playwright = require('playwright').webkit; // Or 'chromium' or 'firefox'.
(async () => {
const browserServer = await playwright.launchServer();
@@ -678,7 +678,7 @@ One of the following values: `'log'`, `'debug'`, `'info'`, `'error'`, `'warning'
An example of using `Dialog` class:
```js
-const playwright = require('playwright');
+const playwright = require('playwright').chromium; // Or 'firefox' or 'webkit'.
(async () => {
const browser = await playwright.launch();
@@ -715,7 +715,7 @@ const playwright = require('playwright');
ElementHandle represents an in-page DOM element. ElementHandles can be created with the [page.$](#pageselector) method.
```js
-const playwright = require('playwright');
+const playwright = require('playwright').chromium; // Or 'firefox' or 'webkit'.
(async () => {
const browser = await playwright.launch();
@@ -982,7 +982,7 @@ At every point of time, page exposes its current frame tree via the [page.mainFr
An example of dumping frame tree:
```js
-const playwright = require('playwright');
+const playwright = require('playwright').firefox; // Or 'chromium' or 'webkit'.
(async () => {
const browser = await playwright.launch();
@@ -1413,7 +1413,7 @@ await page.waitFor(selector => !!document.querySelector(selector), {}, selector)
The `waitForFunction` can be used to observe viewport size change:
```js
-const playwright = require('playwright');
+const playwright = require('playwright').firefox; // Or 'chromium' or 'webkit'.
(async () => {
const browser = await playwright.launch();
@@ -1488,7 +1488,7 @@ immediately. If the selector doesn't appear after the `timeout` milliseconds of
This method works across navigations:
```js
-const playwright = require('playwright');
+const playwright = require('playwright').webkit; // Or 'chromium' or 'firefox'.
(async () => {
const browser = await playwright.launch();
@@ -1770,7 +1770,7 @@ Page provides methods to interact with a single tab or [extension background pag
This example creates a page, navigates it to a URL, and then saves a screenshot:
```js
-const playwright = require('playwright');
+const playwright = require('playwright').webkit; // Or 'chromium' or 'firefox'.
(async () => {
const browser = await playwright.launch();
@@ -2238,7 +2238,7 @@ If the `playwrightFunction` returns a [Promise], it will be awaited.
An example of adding an `md5` function into the page:
```js
-const playwright = require('playwright');
+const playwright = require('playwright').firefox; // Or 'chromium' or 'webkit'.
const crypto = require('crypto');
(async () => {
@@ -2262,7 +2262,7 @@ const crypto = require('crypto');
An example of adding a `window.readfile` function into the page:
```js
-const playwright = require('playwright');
+const playwright = require('playwright').chromium; // Or 'firefox' or 'webkit'.
const fs = require('fs');
(async () => {
@@ -2758,7 +2758,7 @@ Waits for event to fire and passes its value into the predicate function. Resolv
The `waitForFunction` can be used to observe viewport size change:
```js
-const playwright = require('playwright');
+const playwright = require('playwright').webkit; // Or 'chromium' or 'firefox'.
(async () => {
const browser = await playwright.launch();
@@ -2866,7 +2866,7 @@ immediately. If the selector doesn't appear after the `timeout` milliseconds of
This method works across navigations:
```js
-const playwright = require('playwright');
+const playwright = require('playwright').chromium; // Or 'firefox' or 'webkit'.
(async () => {
const browser = await playwright.launch();
@@ -3749,7 +3749,7 @@ Playwright can be used for testing Chrome Extensions.
The following is code for getting a handle to the [background page](https://developer.chrome.com/extensions/background_pages) of an extension whose source is located in `./my-extension`:
```js
-const playwright = require('playwright');
+const playwright = require('playwright').chromium;
(async () => {
const pathToExtension = require('path').join(__dirname, 'my-extension');
diff --git a/docs/web.md b/docs/web.md
index 6c74279adf..42ddb52989 100644
--- a/docs/web.md
+++ b/docs/web.md
@@ -10,11 +10,10 @@ API consists of a single `connect` function, similar to
[webkitPlaywright.connect(options)](api.md#webkitplaywrightconnectoptions).
```html
-
+