How to map page.locator to $ in playwright using a fixture

56 Views Asked by At

I want to map the page.locator to a simpler "$" much like the query in the past. But when I try to make it with a fixture it fails with the error.

$: [async ({ page }, use) => {
  const $ = page.locator;
 
  await use($);
}, { scope: 'worker' }]

The error is: worker fixture "$" cannot depend on a test fixture "page" defined in ../../node_modules/playwright/lib/index.js:918:39.

0

There are 0 best solutions below