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

Click with promise.All #8

Closed
nocelab opened this issue Feb 10, 2022 · 2 comments
Closed

Click with promise.All #8

nocelab opened this issue Feb 10, 2022 · 2 comments

Comments

@nocelab
Copy link
Contributor

nocelab commented Feb 10, 2022

I'm testing site navigation with Playwright codegen mode (https://playwright.dev/docs/codegen) and I note that some click produce something like:

await Promise.all([
   page.click('text=Confirm'),
   page.waitForNavigation(),
]);

I have a spefic page where this is importat because of some async RestAPI calls.
How could be handle it with HBrowser?

@Osiris-Team
Copy link
Owner

Osiris-Team commented Feb 10, 2022

Something like this should do it i think:

playwrightWindow.getJsContext().executeJavaScript(""+
"await Promise.all([\n"+
" page.click('text=Confirm'),\n"+
"page.waitForNavigation()\n"+ // U had a "," too much in ur example.
"]);"); 

The js code above is then executed in the windows nodejs context.

@nocelab
Copy link
Contributor Author

nocelab commented Feb 10, 2022

Very good solution... thanks!

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