fillForms() function. You can execute a number of web-based workflows, including completing multiple forms with user-provided data, tracking submissions in real time, and eliminating repetitive manual work.
Here’s a summary of what the AgP JS SDK empowers you to do when automating web form submissions:
- Find and fill multiple web forms automatically.
- Add user-provided data efficiently and accurately.
- Track the status of each submission in real time.
- Complete all tasks without manual intervention.
Automate web form submissions
Situation: You need to fill out multiple online forms (for example, job applications, surveys, or customer feedback forms) but manually entering the same data repeatedly is slow, error-prone, and tedious. Problem: How can you automatically fill out multiple web forms accurately and efficiently, while tracking submission progress, without building complex scripts or integrations from scratch? Solution: The AgP JS SDK lets you automate web form submissions using thefillForms() function. It enables you to define the forms to fill, provide the necessary data, and monitor progress in real time. With automated form completion and event tracking, you can save time, reduce errors, and handle repetitive tasks without manual intervention.
Fill and automate forms
The steps below show you how to fill and automate forms using the AgP JS SDK:Step 1: Define the forms
Create an array of forms with the URL and data you want to submit.Step 2: Start a form-filling task
For each form, callagent.fillForm(url, data) to let the agent fill the form automatically.
Step 3: Track task status
Usetask.onStatusChange to monitor updates and see progress in real time.
Step 4: Wait for completion
Callawait task.waitForCompletion() to ensure the agent finishes before moving on to the next form.
Step 5: Run your code
Now that your forms and event listeners are defined, you can execute the full workflow. This example loops through multiple forms, fills each one automatically, and logs progress in real time.Reminder: Run your commands wrapped in an
async () function so they work in sequence.Outcome
The AgP JS SDK, running the above code asyncronously, will follow a sequence that:- Initializes the SDK and authenticates through Portal-H.
- Provides real-time updates.
- Generates an accurate and detailed response, for example:
Screenshot example

.png)
