
Always Be Updating
Learn the simple steps to update Playwright and its browsers so you're always running with the latest features and fixes.
Everyone knows that Playwright is a powerful tool for browser automation, but like any evolving framework, it benefits from regular updates. Staying current ensures you have the latest bug fixes, security patches, and new features. Here's how to keep your Playwright setup up to date in just a few steps.
Step 1: Check for Updates
First, use npm to see if an update is available for Playwright:
npm outdated @playwright/test
If an update is listed, you're ready to move forward.
Step 2: Update Playwright
Run the following command to update Playwright and its browser binaries:
npm install @playwright/test@latest
Then, download the latest browser versions:
npx playwright install
Step 3: Verify Your Installation
Confirm that Playwright is using the latest version:
npx playwright --version
Step 4: Test Your Code
After updating, it's a good idea to rerun your tests and make sure nothing breaks:
npx playwright test
Bonus: Automate the Check
Add this script to your package.json
to check for updates regularly:
"scripts": {
"check-playwright-update": "npm outdated @playwright/test"
}
Then run it with:
npm run check-playwright-update
Permalink
Using Async in Playwright with TypeScript
Some Tips and Tricks with the Async feature
In automated browser testing, dealing with asynchronous operations is a fundamental challenge.
Playwright, embraces the asynchronous nature of web interactions
by heavily relying on async
and await
. This guide will
look into into why async
is crucial for your Playwright tests with TypeScript, and what
alternatives exist for handling timing in your test scripts.
Why Async and Await are Indispensable in Playwright
As Playwright interacts with web browsers, almost every action, from navigating to a URL to clicking a button, is an asynchronous operation. This means the action does not complete instantaneously; instead, it initiates a process and returns a Promise that will resolve once the operation is finished.
This is where async
and await
come into play.
async
keyword: You declare a function asasync
to indicate that it will perform asynchronous operations and will implicitly return a Promise. Every Playwright test function you write will typically be anasync
function because browser automation is inherently asynchronous.await
keyword: This keyword can only be used inside anasync
function. When youawait
a Promise, your code execution pauses until that Promise settles (either resolves successfully or rejects with an error). This is critical for Playwright, as it ensures your test steps execute in the correct order and wait for the browser to reach the desired state before proceeding. Withoutawait
, your test might try to interact with an element that hasn't loaded yet, leading to flaky or failed tests.
Consider a simple Playwright test scenario:
import { test, expect } from '@playwright/test';
test('should navigate to a page and find an element', async ({ page }) => {
// Navigating to a URL is an asynchronous operation.
await page.goto('https://www.example.com');
// Clicking a button is also asynchronous.
await page.click('button#submit-button');
// Asserting the visibility of an element needs to wait for it to appear.
await expect(page.locator('#success-message')).toBeVisible();
});
In this example, each await
ensures that the preceding browser action
has completed before the next line of code executes. This makes your tests reliable,
readable, and easy to debug.
Alternative Approaches to Handling Asynchronicity (and Why Playwright's Approach is Superior)
While async
and await
are the standard and recommended way to handle
asynchronicity in Playwright, it's worth understanding the alternatives that exist in
JavaScript/TypeScript, and why they are generally less suitable for Playwright tests.
1. Callbacks
Before Promises and async/await
became widespread, callbacks were the primary mechanism
for handling asynchronous operations. A callback function is executed once an asynchronous operation
completes.
// This is a simplified, non-Playwright example to illustrate callbacks
function fetchData(url: string, callback: (data: string) => void) {
// Imagine an HTTP request here
setTimeout(() => {
callback(`Data from ${url}`);
}, 1000);
}
// fetchData('https://api.example.com/data', (data) => {
// console.log(data);
// });
Why it's not ideal for Playwright: Callbacks can lead to "callback hell" or "pyramid of doom" when dealing with multiple sequential asynchronous operations, making code difficult to read, maintain, and debug. Playwright's API is built on Promises, making callbacks an unnatural fit.
2. Raw Promises (.then()
, .catch()
)
Promises provide a cleaner alternative to callbacks for handling asynchronous operations.
You can chain .then()
methods to handle successful resolutions and .catch()
to handle errors.
// A Playwright-like example using raw Promises
import { test } from '@playwright/test';
// test('should navigate using raw promises', ({ page }) => {
// page.goto('https://www.example.com')
// .then(() => page.click('button#submit-button'))
// .then(() => page.waitForSelector('#success-message'))
// .then(() => console.log('Operation complete'))
// .catch((error) => console.error('An error occurred:', error));
// });
Why async/await
is preferred: While functional, using raw .then()
chains can still be less readable and harder to reason about than async/await
, especially
when dealing with conditional logic or error handling that requires more complex flow. async/await
makes asynchronous code look and behave more like synchronous code, significantly improving readability and maintainability.
3. Implicit Waiting and Auto-Waiting (Playwright's Built-in Features)
It's important to differentiate between explicit await
for Playwright actions and
Playwright's powerful built-in auto-waiting mechanisms. Playwright automatically waits for
elements to be actionable (e.g., visible, enabled, not obscured) before performing actions like clicks
or typing. It also waits for navigations to complete and network idle.
Example of Playwright's auto-waiting:
import { test, expect } from '@playwright/test';
test('Playwright auto-waits for click', async ({ page }) => {
await page.goto('https://demo.playwright.dev/todomvc');
// Playwright will automatically wait for the input to be ready
await page.locator('.new-todo').fill('Buy groceries');
await page.locator('.new-todo').press('Enter');
// Playwright will wait for the list item to appear
await expect(page.locator('.todo-list li')).toHaveText('Buy groceries');
});
Relationship with async/await
: While Playwright handles many waits implicitly,
you still need await
for the Playwright methods themselves to ensure the *initiation*
of the action and the *resolution* of its underlying Promise. Playwright's auto-waiting
is an internal optimization that works in conjunction with your async/await
structure
to make your tests robust without requiring explicit sleep
or setTimeout
calls.
Conclusion
For building reliable and readable Playwright tests with TypeScript, embracing async
and await
is not just a best practice, it's a fundamental requirement. They provide a
clear, sequential way to write asynchronous code, mirroring the user's interaction with a
browser. While other asynchronous patterns exist, none offer the same level of clarity and
integration with Playwright's promise-based API. By mastering async/await
, you
will write more efficient, maintainable, and robust end-to-end tests.
CSS Selector Reference Sheet in PlayWright
PlayWright with Typescript reference guide
When working with Playwright and TypeScript, having a concise reference guide for selectors and locators can significantly improve productivity. This cheat sheet highlights commonly used locator strategies and actions in Playwright - ideal for anyone writing end-to-end tests or automating modern web applications.
Below is a handy visual cheat sheet that you can download and keep nearby during your testing work.

Highlights from the Cheat Sheet
Here's a breakdown of some key locator patterns and actions:
// CSS Selectors
page.locator('#id');
page.locator('.class');
page.locator('tagname');
page.locator('[data-test="button"]');
// By Text
page.locator('text=Submit');
page.locator('text=/Submit/i');
page.getByText('Submit');
// By Role (Recommended for accessibility)
page.getByRole('button', { name: 'Submit' });
page.getByRole('textbox', { name: 'Username' });
page.getByRole('checkbox', { name: 'Remember me' });
page.getByRole('link', { name: 'Learn More' });
// By Test ID
page.getByTestId('submit-button');
// Filtering Locators
page.locator('div.card').getByRole('button', { name: 'Add to Cart' });
page.locator('.item').first();
page.locator('.item').last();
page.locator('.item').nth(2);
// Filter by text content
page.locator('.product-item').filter({ hasText: 'Limited Edition' });
// Filter by child element
page.locator('.product-card').filter({ has: page.locator('.discount-badge') });
// Actions on Locators
await page.locator('#element').click();
await page.locator('#element').fill('value');
await page.locator('#element').scrollIntoViewIfNeeded();
This cheat sheet is great for both beginners and experienced QA engineers who want quick access to essential Playwright syntax. It covers a variety of selector strategies from basic CSS to accessibility-driven roles and filtering techniques.
Feel free to print it out, save it, or bookmark this post for future reference.
PermalinkGet By Selector Cheat Sheet
A handy reference guide for Playwright's "Get By" selectors using TypeScript.
About This Cheat Sheet
When working with Playwright in TypeScript, selecting elements efficiently is key to writing robust automation scripts. Playwright provides a variety of "Get By" methods to locate elements based on different attributes, text, roles, and more. This cheat sheet summarizes the most commonly used methods, making it a quick reference for developers and testers alike.
Below is the code from the cheat sheet, formatted for easy reading. Feel free to copy and use it in your projects.
Code Breakdown
const element = await page.getByText('Click me');
const input = await page.getByLabel('Username');
const input = await page.getByPlaceholder('Enter your name');
const image = await page.getByAlt('Product Image');
const link = await page.getByTitle('Learn More');
const button = await page.getByRole('button');
const component = await page.getByTestId('product-card');
const nav = await page.getByAriaLabel('Main Navigation');
How to Use These Selectors
- getByText: Selects an element containing the specified text.
- getByLabel: Targets input elements by their associated label text.
- getByPlaceholder: Finds input elements by their placeholder text.
- getByAlt: Selects image elements by their alt text.
- getByTitle: Targets elements with a specific title attribute.
- getByRole: Selects elements by their ARIA role for better accessibility.
- getByTestId: Finds elements by a custom data-testid attribute, often used in testing.
- getByAriaLabel: Targets elements by their ARIA label for accessibility-focused testing.
Keep this cheat sheet handy as you build your Playwright scripts. Download the image above to have it as a quick reference whenever you need it.
PermalinkYour Go-To Playwright TypeScript Cheat Sheet
Some Common Commands around Navigation and Clicking
If you are working with Playwright and TypeScript for your automated tests, you know how crucial it is to have quick access to common commands. We have put together a handy cheat sheet that covers essential Playwright operations, making your development process smoother and faster.
This cheat sheet is designed as a quick reference guide, perfect for both beginners getting started with Playwright and experienced users who need a reminder of specific syntax. It is organized into logical sections, covering navigation, input, clicking, content retrieval, and dialog handling.

Download Playwright Cheat Sheet (JPG)
What's Included in the Cheat Sheet?
Here is a breakdown of the key areas covered in this valuable resource:
Navigation
Learn how to navigate through web pages with commands like page.goto()
, page.goBack()
, page.goForward()
, and page.reload()
. Also included are useful page.waitForURL()
and page.waitForLoadState()
examples to ensure your tests wait for the page to be ready.
// Navigation
await page.goto('https://www.example.com');
await page.goBack();
await page.goForward();
await page.reload();
await page.waitForURL('**/dashboard'); // Waits for URL to match a pattern
await page.waitForLoadState('networkidle'); // 'load', 'domcontentloaded', 'networkidle'
Input
Handling user input is a core part of testing. This section demonstrates how to fill text fields using page.fill()
, type character by character with page.type()
, press specific keys with page.press()
, and manage dropdowns with page.selectOption()
. It also shows how to upload files using page.setInputFiles()
.
// Input
await page.fill('#username', 'myUser'); // Fills input field
await page.type('#search-input', 'playwright'); // Types character by character
await page.press('body', 'Escape'); // Presses a key on the page
await page.selectOption('#country-select', 'USA'); // Selects option by value
await page.selectOption('#multi-select', ['option1', 'option2']); // Multi-select
await page.setInputFiles('input[type="file"]', 'path/to/file.png'); // Uploads file
Clicking & Interaction
From simple clicks to more advanced interactions, this part of the cheat sheet covers page.click()
, double clicks with page.dblclick()
, checking and unchecking checkboxes/radios using page.check()
and page.uncheck()
. You will also find examples for hovering over elements with page.hover()
, focusing on input fields with page.focus()
, granular keyboard control with page.keyboard.press()
, and clicking at specific coordinates with page.mouse.click()
.
// Clicking & Interaction
await page.click('button#submit');
await page.dblclick('.item');
await page.check('#remember-me'); // Checks a checkbox/radio
await page.uncheck('#subscribe'); // Unchecks a checkbox
await page.hover('.menu-item');
await page.focus('input-field');
await page.keyboard.press('Enter'); // More granular keyboard control
await page.mouse.click(100, 200); // Clicks at specific coordinates
Content Retrieval
Extracting information from the page is essential for assertions. This section provides commands to get text content using page.innerText()
, HTML content with page.innerHTML()
, input values via page.inputValue()
, and attribute values with page.getAttribute()
.
// Content Retrieval
const text = await page.innerText('.welcome-message');
const html = await page.innerHTML('#content');
const value = await page.inputValue('input-field');
const attribute = await page.getAttribute('img', 'alt');
Dialog
Learn how to handle browser dialogs such as alerts, confirms, and prompts. The cheat sheet illustrates how to listen for dialog events using page.on('dialog')
and how to accept or dismiss them with dialog.accept()
and dialog.dismiss()
.
// Dialog
page.on('dialog', async dialog => {
console.log(dialog.message());
await dialog.accept(); // Or dialog.dismiss()
});
await page.click('#show-alert-button');
We hope this Playwright TypeScript Cheat Sheet becomes an indispensable tool in your automation journey. Keep it handy and happy testing!
PermalinkMastering Double Clicks in Playwright with TypeScript
Learn how to master the double mouse click
In web automation, simulating user interactions accurately is key. One common interaction is the double click, often used to open files, edit text, or trigger specific UI behaviors. Playwright, a robust automation library, provides straightforward methods to perform such actions. This post will guide you through simulating a double click using Playwright with TypeScript.
Performing a Double Click with Playwright
Playwright offers a dedicated method, dblclick()
, on its Page
and
Locator
objects, making double clicking a breeze. You can target an element using a
CSS selector, XPath, or Playwright's built in text/role locators.
Example 1: Double Clicking by CSS Selector
Let us consider a scenario where you want to double click a button with the ID
myDoubleClickButton
.
import { test, expect } from '@playwright/test';
test('should perform a double click on a button', async ({ page }) => {
// Navigate to a page where your button exists
await page.goto('https://example.com/double-click-page');
// Double click the element using its CSS selector
await page.dblclick('#myDoubleClickButton');
// Optionally, add an assertion to verify the double click's effect
// For instance, check if a new element appeared or text changed
await expect(page.locator('#doubleClickResult')).toHaveText('Button was double clicked!');
});
Example 2: Double Clicking a Text Element
Sometimes you might need to double click on a piece of text. Playwright's text locator is very convenient for this.
import { test, expect } from '@playwright/test';
test('should double click on specific text', async ({ page }) => {
await page.goto('https://example.com/text-selection-page');
// Double click on the text "Editable Content"
await page.getByText('Editable Content').dblclick();
// Verify that the element is now in an editable state or shows a specific behavior
await expect(page.locator('.editable-field')).toHaveAttribute('contenteditable', 'true');
});
Example 3: Controlling the Click Options
The dblclick()
method also accepts an options object, allowing you to fine tune the
behavior. For example, you can specify a delay between clicks, force the action, or click at a
specific position within the element.
import { test, expect } from '@playwright/test';
test('should double click with specific options', async ({ page }) => {
await page.goto('https://example.com/advanced-click-page');
await page.locator('.custom-element').dblclick({
delay: 500, // Wait 500ms between the two clicks
position: { x: 10, y: 10 } // Click at coordinates 10,10 relative to the element
});
await expect(page.locator('#statusMessage')).toHaveText('Custom double click performed');
});
Common options for dblclick()
include:
delay
: Time in milliseconds to wait between the two clicks.button
: The mouse button to use ('left', 'right', 'middle'). Default is 'left'.modifiers
: An array of modifier keys to press ('Alt', 'Control', 'Meta', 'Shift').position
: A `{ x, y }` object to click at a specific point relative to the top-left corner of the element.force
: Forces the action, even if the element is not considered actionable (e.g., it is hidden).
Popular Assertions in Playwright with TypeScript
Top 5 Assertions That People Use
A guide to the most commonly used assertions in Playwright for robust test automation with TypeScript.
Playwright's expect
function offers a variety of
assertions to validate webpage elements, states, and behaviors. Below
are the most popular ones, with TypeScript examples.
1. toBeVisible
Verifies that an element is visible on the webpage. This is useful for checking if UI components render correctly.
import { test, expect } from '@playwright/test';
test('should display header', async ({ page }) => {
await page.goto('https://example.com');
const header = page.locator('h1');
await expect(header).toBeVisible();
});
This test navigates to a webpage and checks if an
h1
element is visible.
2. toHaveText
Asserts that an element contains the specified text. It can match exact text or a regular expression.
test('should have correct button text', async ({ page }) => {
await page.goto('https://example.com');
const button = page.locator('button#submit');
await expect(button).toHaveText('Submit');
});
Use this to verify text content in buttons, labels, or other elements.
3. toHaveAttribute
Checks if an element has a specific attribute with an expected value,
such as class
, id
, or custom attributes.
test('should have disabled attribute', async ({ page }) => {
await page.goto('https://example.com');
const input = page.locator('input#username');
await expect(input).toHaveAttribute('disabled', '');
});
This is ideal for testing element states like disabled or checked inputs.
4. toBeEnabled / toBeDisabled
Verifies whether an element is enabled or disabled, commonly used for form controls.
test('should have enabled submit button', async ({ page }) => {
await page.goto('https://example.com');
const button = page.locator('button#submit');
await expect(button).toBeEnabled();
});
Use toBeDisabled
for the opposite case.
5. toHaveValue
Asserts that an input element (e.g., input
,
textarea
) has a specific value.
test('should have input value', async ({ page }) => {
await page.goto('https://example.com');
const input = page.locator('input#username');
await input.fill('testuser');
await expect(input).toHaveValue('testuser');
});
Permalink
Filtering Locators by Text Content in Playwright with TypeScript
How I used Playwright's locator filtering to extract data
Introduction
Automating web testing often involves interacting with elements that lack unique identifiers like IDs or classes. In such cases, Playwright's powerful locator filtering capabilities can save the day. In this post, we'll explore how to filter locators by text content in TypeScript, using a real-world example from the American Freight Refrigerators & Freezers page.
Our goal is to capture the number of items displayed on the page, where the text (e.g., "Showing 24 results") is not tied to a unique ID. We'll use Playwright's text-based filtering and parse the result to extract the number.
The Challenge
On the American Freight page, the text indicating the number of results is displayed dynamically, something like:
Showing 24 results
The element containing this text doesn't have a unique ID or class, making it tricky to locate directly. A naive approach might grab multiple elements with similar text, leading to incorrect results. Playwright's locator filtering allows us to narrow down the search by combining text matching with additional conditions.
Screenshot of the page that I am testing.
Solution: Playwright Locator Filtering
Playwright provides the getByText
method to locate elements by their text content. We can further refine this using the filter
method to ensure we target the exact element. Here's how it works:
- Use
page.getByText('Showing', { exact: false })
to find elements containing the word "Showing". - Apply
filter({ hasText: 'results' })
to narrow down to elements that also contain "results". - Extract the text content and parse it to get the number using a regular expression.
Below is the complete TypeScript code for the test:
import { test, expect } from '@playwright/test';
test('American Freight Refrigerator Numbers', async ({ page }) => {
await page.goto('https://www.americanfreight.com/plp/appliances/refrigerators-freezers/695');
// Locate element with text starting with "Showing" and containing "results"
const locator = page.getByText('Showing', { exact: false });
const element = locator.filter({ hasText: 'results' });
const text = await element.innerText();
const match = text.match(/Showing (d+) results/);
const resultsNumber = match ? match[1] : null;
console.log(`Number of results: ${resultsNumber}`);
expect(resultsNumber).not.toBeNull();
});
Code Breakdown
Let's dissect the key parts of the code:
- Navigating to the Page:
await page.goto(...)
loads the American Freight page. - Locating by Text:
page.getByText('Showing', { exact: false })
finds all elements containing "Showing". Theexact: false
option allows partial matches. - Filtering:
locator.filter({ hasText: 'results' })
refines the locator to only include elements that also contain "results". - Extracting Text:
await element.innerText()
retrieves the full text content (e.g., "Showing 24 results"). - Parsing the Number: The regex
/Showing (d+) results/
captures the number between "Showing" and "results". The result is stored inresultsNumber
.
Why Use Locator Filtering?
Locator filtering is a game-changer for several reasons:
- Precision: It allows you to target elements based on multiple conditions, reducing false positives.
- Flexibility: You can combine text, attributes, or even child elements in the filter.
- Robustness: It handles dynamic content where IDs or classes may change.
In our example, filtering ensured we got the exact element with "Showing" and "results", avoiding other elements with similar text.
Tips for Success
- Inspect the Page: Use browser DevTools to confirm the text content and structure before writing your locator.
- Test Your Locator: Use Playwright's
locator.count()
orlocator.all()
to verify how many elements match your criteria. - Handle Edge Cases: Add checks for
null
or unexpected text formats, as we did with the regex match. - Debugging: Log the
innerText
or use Playwright's tracing to inspect the locator's behavior.
Conclusion
Playwright's locator filtering by text content is a powerful tool for tackling elements without unique identifiers. By combining getByText
and filter
, we successfully extracted the number of refrigerators from the American Freight page. This approach is versatile and can be adapted to many scenarios in web automation.
Try it out in your next Playwright project, and explore other filtering options like has
or hasNotText
to handle even more complex cases!
Validating Todays Date with Playwright and TypeScript
Learn how to use Playwright with TypeScript to check if today\\\'s date is displayed on a web page.
In this tutorial, we'll create a Playwright script in TypeScript to validate that today's date is present on a web page. This is useful for testing dynamic content, such as date displays in web applications.
Writing the Validation Script
We'll write a script to navigate to a web page, extract text from an element, and verify if it contains today's date. For this example, we'll assume the page displays the date in a format like "April 30, 2025" (you can adjust the format as needed).
Create a file named src/validate-date.ts
with the following code:
import { chromium, Browser, Page } from 'playwright';
async function validateTodaysDate(): Promise {
// Launch browser
const browser: Browser = await chromium.launch();
const page: Page = await browser.newPage();
try {
// Navigate to the page (replace with your target URL)
await page.goto('https://example.com');
// Get today's date in the format "April 30, 2025"
const today: string = new Date().toLocaleDateString('en-US', {
month: 'long',
day: 'numeric',
year: 'numeric'
});
// Locate the element containing the date (adjust selector as needed)
const dateElement = await page.locator('h1'); // Example: April 30, 2025
const pageDate: string = await dateElement.textContent() || '';
// Validate the date
if (pageDate.includes(today)) {
console.log(`Success: Today's date "${today}" is displayed on the page.`);
} else {
console.error(`Failure: Expected "${today}", but found "${pageDate}".`);
}
} catch (error) {
console.error(`Error: ${(error as Error).message}`);
} finally {
// Close browser
await browser.close();
}
}
// Run the script
validateTodaysDate();
This script:
- Launches a Chromium browser using Playwright.
- Formats today's date using
toLocaleDateString
to match the expected format. - Navigates to the target page and extracts text from a specified element (e.g., an
h1
tag). - Checks if the element's text contains today's date.
- Logs success or failure and handles errors.
Note: Replace https://example.com
with your target URL and adjust the locator
selector (e.g., 'h1'
) to match the element containing the date on your page.
Running the Script
Compile and run the TypeScript script using:
npx ts-node src/validate-date.ts
Example output if the date is found:
Success: Today's date "April 30, 2025" is displayed on the page.
If the date is not found or an error occurs, you'll see an appropriate error message.
Conclusion
Using Playwright with TypeScript, you can reliably validate dynamic content like today's date on a web page. TypeScript's type safety helps catch errors early, while Playwright's powerful APIs simplify browser automation. Customize the selector and date formats to fit your use case, and consider integrating with Playwright's test framework for robust testing.
For further exploration, try adding visual regression testing or combining with CI/CD pipelines to automate date validation in your workflows.
Measuring Page Load Time with Playwright
Learn how to use Playwright to measure how long it takes for a web page to load.
One of its many capabilities PlayWright is measuring page performance metrics, such as load times. In this tutorial, we'll walk through how to use Playwright to record the time it takes for a page to fully load.
Writing the Script
Create a file named measure-load-time.js
and add the following code to measure the page load time for a website (e.g., example.com):
const { chromium } = require('playwright');
(async () => {
// Launch browser
const browser = await chromium.launch();
const page = await browser.newPage();
// Record start time
const startTime = performance.now();
// Navigate to the page
await page.goto('https://example.com');
// Wait for the page to fully load
await page.waitForLoadState('load');
// Record end time
const endTime = performance.now();
// Calculate load time
const loadTime = endTime - startTime;
console.log(`Page load time: ${loadTime.toFixed(2)} ms`);
// Close browser
await browser.close();
})();
This script:
- Launches a Chromium browser using Playwright.
- Records the start time using
performance.now()
. - Navigates to the specified URL.
- Waits for the
load
event, indicating the page is fully loaded. - Calculates the load time by subtracting the start time from the end time.
- Outputs the result in milliseconds.
Running the Script
Run the script using Node.js:
node measure-load-time.js
You should see output similar to:
Page load time: 1234.56 ms
The actual time will vary depending on the website, network conditions, and system performance.
About
Welcome to Playwright Tips and Tricks, your go-to resource for mastering the art of web automation and testing with Playwright! Whether you're a seasoned developer looking to streamline your workflows or a curious beginner eager to dive into the world of browser automation, this blog is designed with you in mind. Here, I'll share a treasure trove of practical insights, clever hacks, and step-by-step guides to help you harness the full power of Playwright - a modern, open-source tool that's revolutionizing how we interact with web applications.
Check out all the blog posts.
Blog Schedule
Thursday | Business |
Friday | Macintosh |
Saturday | Internet Tools |
Sunday | Open Topic |
Monday | Media Monday |
Tuesday | QA |
Wednesday | Veed |
Other Posts
- Speed Up Your Tests with storageState()
- Popular Assertions in Playwright with TypeScript
- Parametrization in PlayWright
- PlayWright URL Scraping
- Modern Number Formatting
- CSS Selector Reference Sheet in PlayWright
- Using Async in Playwright with TypeScript
- In Automation Consistency Is Key
- Always Be Updating
- PlayWrite Date format
- Measuring Page Load Time with Playwright
- Your Go-To Playwright TypeScript Cheat Sheet
- Filtering Locators by Text Content in Playwright with TypeScript
- Get By Selector Cheat Sheet
- XPath with Playwright page.locator