Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] page.$: add waitForSelector as optional parameter #5936

Closed
Ank2503 opened this issue Mar 24, 2021 · 1 comment
Closed

[Feature] page.$: add waitForSelector as optional parameter #5936

Ank2503 opened this issue Mar 24, 2021 · 1 comment

Comments

@Ank2503
Copy link

Ank2503 commented Mar 24, 2021

Is it possible to add optional parameter in page.$ to wait for selector first, than perform searching, another words replacing
await page.waitForSelector('selector'); await page.$('selector');
with
await page.$('selector',{waitFor: true});
or something like it, because for my tests $ or $$ functions sometimes return undefined

@JoelEinbinder
Copy link
Contributor

waitForSelector returns the selector, so you can just do

const handle = await page.waitForSelector('selector');
await handle.click();

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

No branches or pull requests

2 participants