# playwright-mini

> [docs](#docs)

Latest version **1.0.1** (published 2020-11-22) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install playwright-mini
pnpm add playwright-mini
yarn add playwright-mini
bun add playwright-mini
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-11-22 |
| First published | 2020-11-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 181.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | shirshak |

## Links

- npm: https://www.npmjs.com/package/playwright-mini
- Repository: https://github.com/shirshak55/playwright-mini
- npm.io page: https://npm.io/package/playwright-mini

## Recent versions

- 1.0.1 (latest) — 2020-11-22
- 1.0.0 — 2020-11-16

## README

### Playwright Mini

[docs](#docs)

It is simple replacement of puppeteer extra but for playwright.

### Why?

Because google killed puppetter. Its not maintained properly. Lots of old bugs related to cookies are not fixed. And I dont see any future with puppetter.

### Why renamed Playwright Extra to Playwright Mini?

Actually I didn't realized the original developer have been developing another version of playwright extra. So I think they deserve the original name. I will be handing them the package name in future.

### Usage?

First create a project

```bash
mkdir automation
cd automation
yarn init
```

Create a tsconfig.json file and make it look like this. Feel free to adjust it :)

```json
{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "declaration": false,
        "declarationMap": false,
        "inlineSourceMap": true,
        "outDir": "./dist",
        "rootDir": "./src",
        "noEmit": false,
        "downlevelIteration": true,
        "strict": true,
        "noEmitOnError": true,

        "noUnusedLocals": true,
        "noUnusedParameters": true,
        "noImplicitReturns": true,
        "noFallthroughCasesInSwitch": true,

        "allowSyntheticDefaultImports": true,
        "esModuleInterop": true,

        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "skipLibCheck": true,
        "forceConsistentCasingInFileNames": true
    },
    "files": ["./src/index.ts"],
    "exclude": ["node_modules"]
}
```

```
yarn add meow playwright playwright-mini source-map-support
yarn add --dev typescript @types/node
```

After adding package.json should look like this. (Add scripts section so we can do `yarn watch` and `yarn start` later)

```json
{
    "name": "automation",
    "version": "1.0.0",
    "main": "index",
    "license": "MIT",
    "scripts": {
        "start": "node dist/main",
        "watch": "tsc --watch"
    },
    "dependencies": {
        "meow": "^8.0.0",
        "playwright": "^1.6.1",
        "playwright-mini": "^1.0.0",
        "source-map-support": "^0.5.19"
    },
    "devDependencies": {
        "@types/node": "^14.14.7",
        "typescript": "^4.0.5"
    }
}
```

Create src directory with index.ts file inside it

```ts
import "source-map-support/register"
import { Browser, BrowserContext, firefox, Page } from "playwright"
import { pageStealth } from "playwright-mini"

async function main() {
    // If you want to sue chromium import chromium and change headless as ur wish
    let browser = await firefox.launch({ headless: false })
    let context = await browser.newContext({ ignoreHTTPSErrors: true })

    let page = await context.newPage()

    await pageStealth(page)

    await page.goto("https://fast.com")
}

main().catch((e) => {
    cm.error("Error from Main", e)
})
```

### Why Playwright?

Because the original developer from puppetter repo now maintains playwright. And they are cool :)

### Why not same structure as Puppetter Mini?

First I don't like that approach 12 gadget inside 12 folder and one package depending on another package. I am not necessarily saying that approach is bad as its clealy working for thm. I would like to keep it simple and flat.

### What is included in this pacakge?

I don't plan adding too much for simplicity. I just want to add only necessary stuff thats required for automation. Like I am not going to include adblocker extension etc.

-   [x] Stealth
-   [ ] Captcha

### Others

You may want to checkout (scrapper tools)[https://github.com/shirshak55/scrapper-tools]. It provides easy way to make scrapper tools and comes with csv parsers and various other widgets.

### Thanks

-   @berstend his repo is main inspiration to do this.
-   @shirshak55 thats me :D
-   @playwright-team

### Disclaimer

I use it to automate my workflow. Like my bank gives 1 month data but to make summary of my expenditure I need 6 month data. Clearly I don't want to be in mercy of bank so the solution is to automate my workflow.

---
_Source: https://npm.io/package/playwright-mini · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
