Microsoft Playwright Automation Tool

Playwright is a browser automation tool released by the Microsoft team.
Another popular tool similar to it is Selenium. Playwright has a significant advantage in recording and generating code.

Installation

pip install playwright
python -m playwright install

Generate code

python -m playwright codegen

We can use –help to see more options.

python -m playwright codegen --help

Usage: index codegen [options] [url]

open page and generate code for user actions

Options:
  -o, --output <file name>  saves the generated script to a file
  --target <language>       language to use, one of javascript, python, python-async, csharp (default: "python")
  -h, --help                display help for command

Examples:

  $ codegen
  $ codegen --target=python
  $ -b webkit codegen https://example.com

Leave a Reply

Your email address will not be published.