Playwright comes with the command line tools that run via
npx or as a part of the
codegen will attempt to generate resilient text-based selectors.
If you would like to use codegen in some non-standard setup (for example, use browser_context.route(url, handler)), it is possible to call page.pause() that will open a separate window with codegen controls.
open, you can use Playwright bundled browsers to browse web pages. Playwright provides cross-platform WebKit builds that can be used to reproduce Safari rendering across Windows, Linux and macOS.
open can emulate mobile and tablet devices from the
codegen, you can use following API inside the developer tools console of any browser.
Query Playwright selector, using the actual Playwright query engine, for example:
playwright.$, but returns all matching elements.
Reveal element in the Elements panel (if DevTools of the respective browser supports it).
Generates selector for the given element.
PDF generation only works in Headless Chromium.
Opening WebKit Web Inspector will disconnect Playwright from the browser. In such cases, code generation will stop.