title: How to wait for JavaScript to finish in playwright
body: <p>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.</p>
  <pre><code>await page.fill(&quot;#myID&quot;, inputText); 
  await page.keyboard.press('Tab');  // this line trigger the JS
  
  // continue to the next element 
  </code></pre>
  <p>The problem, it is not waiting for JavaScript to finish. How can I wait for JS to finish before the code continue.</p>