Hey everyone! I’m working on automating a Google form using Puppeteer and Node.js but I’m having trouble with a specific dropdown field. The issue is that when I try to select a particular option from the dropdown, the autocomplete feature interferes with my selection. For example, if I want to choose “United Kingdom” from the list, I type “United” followed by a space, but the form automatically selects “United Arab Emirates” instead because it’s the first match that appears. I’ve tried different approaches but the dropdown keeps auto-selecting the first available option rather than waiting for me to specify the exact choice I need. Has anyone dealt with similar Google Forms automation challenges? What’s the best way to handle these autocomplete dropdowns in Puppeteer? Any help would be greatly appreciated!
I encountered this same issue while automating survey forms last year. What solved it for me was using page.select()
with the actual value attribute instead of relying on text input. You need to inspect the HTML source of the Google Form to find the exact value attributes for each option. For instance, “United Kingdom” might have a value like “GB” or “UK”. Once you identify the correct value, you can use await page.select('select[name="your-field-name"]', 'GB')
to directly select the option without triggering the autocomplete behavior. This method is much more reliable since it bypasses the text matching altogether and directly targets the DOM element. The downside is you need to do some initial reconnaissance on the form structure, but it saves time in the long run.
ive had this exact problem before! try typing the full text really slowly with delays between each character using page.type()
with the delay option. also dont use spaces - just type “unitedkingdom” without any gaps and it should match better. worked for me when i was scraping similar forms
Another approach that worked well for me is using keyboard navigation instead of typing. After clicking on the dropdown field, you can use page.keyboard.press('ArrowDown')
to navigate through the options and then page.keyboard.press('Enter')
to select the highlighted item. This bypasses the autocomplete matching entirely. The trick is counting how many arrow key presses you need to reach your target option. I found this more reliable than fighting with the text matching since Google Forms can be unpredictable with partial matches. You might also want to add a small wait after opening the dropdown to ensure all options are loaded before starting navigation.