Skip to content

feat: locator descendants#171

Merged
lino-levan merged 3 commits intolino-levan:mainfrom
adamgreg:locator-children
Oct 2, 2025
Merged

feat: locator descendants#171
lino-levan merged 3 commits intolino-levan:mainfrom
adamgreg:locator-children

Conversation

@adamgreg
Copy link
Contributor

@adamgreg adamgreg commented Oct 1, 2025

I would find it useful to be able to access descendants from a Locator. This PR adds methods to help with that.

@adamgreg adamgreg force-pushed the locator-children branch 2 times, most recently from 089f7ee to df5de2b Compare October 1, 2025 16:12
// deno-lint-ignore no-import-prefix
import type { PageProps } from "https://deno.land/x/pyro@0.6.1/page.ts";
import { ensureFileSync } from "https://deno.land/std@0.215.0/fs/ensure_file.ts";
import { ensureFileSync } from "@std/fs/ensure-file";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: is this change necessary for this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lint check fails for both of those direct https imports, so CI won't pass. You already have the JSR @std/fs in the import map, so I thought this must just be legacy. Couldn't find Pyro on JSR, so just ignored that one.

Would be happy to handle it differently!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see, new deno lints are stricter. Could you instead have the linter ignore the entire docs folder? It's getting rewritten by a friend of mine anyways.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, that's done. The linter will now completely ignore the docs folder.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit to update the import from https://deno.land/std is still in there, but we can drop it if you prefer @lino-levan

await using browser = await launch();
await using page = await browser.newPage(server.address);
const targetLocator = page.locator<HTMLDivElement>("#target");
await page.waitForNetworkIdle();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Why is this wait for network idle necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might not be! This is all new to me. I can remove it tomorrow morning

@adamgreg
Copy link
Contributor Author

adamgreg commented Oct 2, 2025

HTTP Interceptor test failures on Windows seem unrelated and either new or intermittent?

@lino-levan
Copy link
Owner

There is some rare flakiness in some of the tests, better than it used to be but it's definitely not perfect.

@lino-levan lino-levan changed the title Locator descendants feat: locator descendants Oct 2, 2025
@lino-levan lino-levan merged commit 8bc945a into lino-levan:main Oct 2, 2025
5 of 6 checks passed
@adamgreg adamgreg deleted the locator-children branch October 2, 2025 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants