page.click("#submit"), Node sends an instruction to the browser via WebSocket, the browser waits for element stability, and responds. Therefore, every Playwright action returns a Promise!// Sequential execution:
async function completeCheckout(page) {
await page.click("#cart");
await page.fill("#coupon", "DISCOUNT20");
await page.click("#apply-btn");
}// Parallel execution with Promise.all:
async function loadTestData() {
const [users, products] = await Promise.all([
fetchUsersApi(),
fetchProductsApi()
]);
return { users, products };
}