Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 2.65 KB

Quick_Reference_Guide.md

File metadata and controls

43 lines (31 loc) · 2.65 KB

Playwright Python Quick Reference Guide

This page outlines some common functions / utilities that may be useful for users of this blueprint.

Table of Contents

CLI: Playwright Utilities

The following outlines some useful commands to use with the playwright command in the following format:

playwright <command-to-use>
Name Command to use Description
Use code generator codegen <url (optional)> Opens the code generator and a browser window ready to navigate. If a URL is provided, the browser will open on the provided page.
Show trace details show-trace <path-to-zip-file> Opens the trace file generated by Playwright if generated. You need to provide a path to the trace.zip file for it to open.
Install MS Edge install msedge Installs Microsoft Edge for use by Playwright.
Install Chrome install chrome Installs Google Chrome for use by Playwright.

CLI: Pytest Execution Options

The following outlines some useful commands to use with the pytest command in the following format:

pytest <command-to-use>
Name Command to use Description
Tracing on --tracing on Runs all the tests with tracing enabled, generating trace.zip files for each.
Headed mode --headed Runs the tests in headed mode (browser will display on-screen while the test is running).
Run specific markers -m "marker-name" Runs tests with the specified marker / tag (denoted with @pytest.marker.marker-name before the test function).
Exclude specific markers -m "not marker-name" Runs tests without the specified marker / tag (denoted with @pytest.marker.marker-name before the test function).
Run in slow motion --slowmo <value-in-ms> Slows down each operation Playwright conducts by the amount of milliseconds specified.
Generate video --video <on/retain-on-failure> Records a video for each test. If set to on, will keep for all videos. If set to retain-on-failure, only failed test videos are kept.
Run tests in Edge --browser chromium --browser-channel msedge Runs the specified tests in Microsoft Edge.
Run tests in Chrome --browser chromium --browser-channel chrome Runs the specified tests in Google Chrome.
Run tests in Firefox --browser firefox Runs the specified tests in Mozilla Firefox.

Further information can be found in the Playwright documentation.