Neurotic and Probably Misinformed

    This package has been deprecated

    Author message:

    Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

    playwright-mini
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.1 • Public • Published

    Playwright Mini

    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

    mkdir automation
    cd automation
    yarn init

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

    {
        "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)

    {
        "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

    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.

    • 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.

    Keywords

    none

    Install

    npm i playwright-mini

    DownloadsWeekly Downloads

    2

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    186 kB

    Total Files

    15

    Last publish

    Collaborators

    • shirshak