Automating Google Form with javascript

440 Views Asked by At

I have tried to fill in a Google form with required fields (for example). I fill out the text using the 'value' field, but I still receive an error message: "This is a required question"

This is my javascript code:

document.querySelectorAll(".quantumWizTextinputPaperinputInput")[0].value = "My answer here"

I have also tried clicking, focusing, and changing the error attributes.

1

There are 1 best solutions below

1
On

Well i will have two suggestions;

// try with setAttribute function
document
  .querySelectorAll(".quantumWizTextinputPaperinputInput")[0]
  .setAttribute("value", "My answer here");

// Maybe more than one element returns?
document
  .querySelectorAll(".quantumWizTextinputPaperinputInput")
  .forEach((elm) => (elm.value = "My answer here"));