"Automata" is a web application that uses Puppeteer, a Node.js library, to automate form filling in Google Forms. Puppeteer is a powerful tool that provides a high-level API for controlling a headless version of Google Chrome or Chromium.
Here's an elaboration on how this system works:
-
Puppeteer and Headless Browsers:
- Puppeteer allows you to control a headless version of a web browser. A headless browser is a web browser without a graphical user interface. It can be controlled programmatically and is often used for tasks like web scraping or automated testing.
-
Automata's Purpose:
- Automata's main purpose is to automate the process of filling out Google Forms. This is useful in scenarios where you have to repeatedly fill out similar forms, which can be time-consuming and tedious if done manually.
-
Interacting with Google Forms:
- Google Forms are a popular way to collect information through surveys, questionnaires, or data entry forms. Automata interacts with these forms using Puppeteer.
-
Steps to Automate Form Filling:
-
a. Launching the Browser:
- Automata uses Puppeteer to launch a headless browser (e.g., Chrome or Chromium) in the server.
-
b. Navigating to the Form:
- Once the browser is open, Automata navigates to the URL of the Google Form.
-
c. Filling the Form:
- Automata uses Puppeteer to interact with the form fields. For example, if a field requires a short answer, it might use Puppeteer to type in the appropriate response (e.g., "hello + name_of_field").
-
d. Selecting Multiple Choice Options(Checkbox):
- For multiple choice questions, Automata would use Puppeteer to click the first option.
-
e. Submitting the Form:
- After filling out the form, Automata uses Puppeteer to submit the form.
-
f. Handling Success or Errors:
- Automata shows user snapshots of each of the field filled and the submit page from the headless browser
-
-
Headless Mode:
- Using a headless browser means that all of this happens "in the background" without any visible browser window. This is especially useful for automation tasks where a user interface is not required.
-
Advantages:
- Automation with Puppeteer can significantly speed up repetitive tasks, reduce human error, and free up human resources for more complex tasks.
Typescript: TypeScript is preferred for web automation with Puppeteer due to its strong typing, which catches errors before runtime, enhancing code reliability. It offers excellent IDE support, making code development more efficient, and its self-documented nature improves code readability and understanding. TypeScript's static typing system also aids in error checking, resulting in more stable code
Node: Node leverage the power of TypeScript's static typing to build robust server-side APIs, utilizing npm's vast library
Puppeteer - The "puppeteer" package in npm is a Node.js library that provides a high-level API over the Chrome DevTools Protocol, which allows you to control a headless (or non-headless) version of the Google Chrome or Chromium browser. It's often used for tasks related to web scraping, automating tasks in web applications, taking screenshots, generating PDFs, and running automated tests in a browser environment.
Note
:Open terminal window in the application folder, ensure npm is installed on your system , instruction to which could be found here
Note
:Also make sure an instance of chrome/chromium is installed on device running the server, it is needed by pupeteer
npm install
Note:
Before starting the server, make sure a .env
file is made as per the sample provided in .env.sample file
npm start
https://localhost:PORT_NUMBER
Note
:The application after starting the server could be accessed at whichever port it was configured to run on, in the env file.
Make a pull request for your work and wait for it to be merged!
- Fork this repository (Click the Fork button in the top right of this page, click your Profile Image)
- Clone your fork down to your local machine
git clone https://github.com/your-username/Automata.git
- Create a branch
git checkout -b branch-name
- Make your changes (choose from any task below)
- Commit and push
git add .
git commit -m 'Commit message'
git push origin branch-name
- Create a new pull request from your forked repository (Click the
New Pull Request
button located at the top of your repo) - Wait for your PR review and merge approval!
- Star this repository if you had fun!
![Screenshot 2023-09-30 at 12 38 11 AM](https://private-user-images.githubusercontent.com/95176555/271699646-fbf2b344-7a0e-46bc-a497-c5fd3075cce1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxMjM5NTgsIm5iZiI6MTczOTEyMzY1OCwicGF0aCI6Ii85NTE3NjU1NS8yNzE2OTk2NDYtZmJmMmIzNDQtN2EwZS00NmJjLWE0OTctYzVmZDMwNzVjY2UxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA5VDE3NTQxOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJjZmVkZTc4MWYwODMyMjE0MTZhYjU3MWI2ODU1ZWNhNDhlODc1MzU0YTcwODY3ODE4YjlkNDcyM2M1ZTFlMjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.UbeL3fMB3jWslX_-Xh5V2qDmoF_3rjo4Y6phHDSLDc0)
![Screenshot 2023-09-30 at 12 38 19 AM](https://private-user-images.githubusercontent.com/95176555/271699679-34a01176-c899-4c98-b1f6-678d0a120f5c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxMjM5NTgsIm5iZiI6MTczOTEyMzY1OCwicGF0aCI6Ii85NTE3NjU1NS8yNzE2OTk2NzktMzRhMDExNzYtYzg5OS00Yzk4LWIxZjYtNjc4ZDBhMTIwZjVjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA5VDE3NTQxOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBiYWY3NGU5YjNmMjRlMGUxY2JmZmI2OTI4Njc4OWEyMjFjZGJhNDRiZWY4MWM3MGQyMmU0M2E4ZDJmYzM2ODEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.pMPaZLdc6HlrYdhvA5dxUc7foZay2zLDSV1yGLTtbjE)
Automata.mov
- Specifically designed to work with Google Forms, so won't work with other kind of forms
- Moreover the application as of now can only deal with two kinds of entries:
- Short answer type
- Checkbox type multiple choice
- Sometimes the application may miss some fields, though is a rare instance but is persistant. This is due to limitations of network speed of the server or the size of form being processed.
- Presently, the answers to short answer questions is only hello + name_of_the_field, and that of checkbox type is first option only