31

I need to know how can we type a string in input box using puppeteer. I know it can be done like this:

await page.type('input[name=pickup]', 'test comment', {delay: 200})

But what if the input box does not have a name or id, and instead it has a value name or title id? Like this:

await page.type('[title id^="pickupAgingComment"]', 'test comment', {delay: 200})

OR

await page.type('[value name^="pickupAgingComment"]', 'test comment', {delay: 200}) 

The last two does not work actually.

Vinirdishtith Rana
  • 793
  • 1
  • 7
  • 13

1 Answers1

44

ok, I just figured out with this:

await page.type('input[name=pickupAgingComment]', 'test comment', {delay: 20})

Though the selector is a value name, I tried removing value and used just name literal. It is working for value name also.

Vinirdishtith Rana
  • 793
  • 1
  • 7
  • 13