How do I target only direct children from a locator that already has a target?
Example:
import { test, expect, Page } from "@playwright/test";
test("direct descendant", async ({ page }) => {
await page.goto("http://www.uitestingplayground.com/sampleapp");
const containerLocator = page.locator("div.container");
const immediateChildren = containerLocator.locator("> div");
const count = await immediateChildren.count();
expect(count).toBe(4);
});
I get the error locator.count: Unexpected token ">" while parsing selector "> div"
Even css="> div" doesn't work
How do I target only direct children from a locator that already has a target?
Example:
I get the error
locator.count: Unexpected token ">" while parsing selector "> div"Even
css="> div"doesn't work