Playwright Tutorials

Working with locators in Playwright

Locators are an essential feature of Playwright that helps to find elements on a webpage at any time. They also enable Playwright to automatically wait and retry locating an element until it becomes available.

To identify webpage elements in Playwright, we use selectors, which come in various types. Below, we will examine these selector categories in more detail..

After finding an element using a selector, we can perform multiple actions on it, such as clicking, typing text, or retrieving its attribute values etc...

Manage Playwright versions and browsers

As we discussed in the previous article, Playwright tests can only be executed on the browser versions that are shipped with the corresponding Playwright version. For example, Playwright Version 1.31 was shipped with the following browser versions: -

  • Chromium 111.0.5563.19
  • Mozilla Firefox 109.0
  • WebKit 16.4

This version was also tested against the following stable channels:

Launch Playwright tests on different browsers

After setting up Playwright, you may have noticed that it generates a global configuration file called 'playwright.config.ts', which contains default settings. In the configuration projects section, Playwright is configured to run on the three browsers (chromium, firefox, webkit) by default. When executing a Playwright test, it will run on all three browsers.