I am testing UI with Playwright and JavaScript. My code find an input element that can sometimes be a drop down, sometimes a text and sometimes a date. To handle this I enter value with 2 steps. First I fill the text and then click on tab key to invoke the JavaScript that formats the value in the element.
await page.fill("#myID", inputText);
await page.keyboard.press('Tab'); // this line trigger the JS
// continue to the next element
The problem, it is not waiting for JavaScript to finish. How can I wait for JS to finish before the code continue.