Puppeteer – Select value from <select> input element

  javascript, puppeteer

What’s the best way to select an option from a select input type of a form in puppeteer?

I’ve ead that there was a bug in puppeteer and the .type() method was not the ideal way to proceed. The select input type in the form have the options value set with a numerical order. Can I simply use this code to set the value?

    page.$x('/html/body/div[1]/form/div[2]/div/div[10]/select').then( (el) => {
      el.type('1'); // 1 is the first <option value="1">foo</option>

Source: Ask Javascript Questions