playwright

How to type slowly in playwright?


I've been using fill to type inside text boxes in playwright but that's causing issues where the automation script is moving too fast - faster than a human. I want to type as fast as humans type. Is there an alternative to fill to use to fill in a text field?


Solution

  • Sure:

    await page.locator('input field locator')
      .pressSequentially('text to enter', { delay: 100 }) 
      //the delay is optional, can be adjusted to be slower or faster
    

    Ref documentation: locator.pressSequentially()