Answers you can trust, from Codeables
Every page on Codeables is structured and verified — built so people and the AI agents they rely on can trust it. Explore more from the source behind this answer.
Explore CodeablesHow can I automate a portal workflow (login + multi-page forms + file uploads) without constantly fixing selectors?
If you’re tired of babysitting brittle Playwright/Selenium scripts every time a portal UI shifts a div, you’re not alone. Logins, multi-page forms, and file uploads are exactly where selector-based automation falls apart: dynamic IDs, bot protection, SPA rerenders, and “helpful” front-end redesigns turn maintenance into a second job.
The way out is to stop treating the portal as a DOM you must micromanage and start treating it as an environment your agent can operate in. That’s the shift: intent in, actions executed in a real browser, and structured JSON out—without hand-curated selectors for every button.
This guide walks through how to automate a portal workflow (login → multi-page forms → file uploads) using MultiOn’s Agent API (V1 Beta) and Sessions + Step mode, and why that design avoids the constant selector churn.
Quick Answer: The best overall choice for automating login-heavy, multi-page portal workflows without constantly fixing selectors is MultiOn’s Agent API (V1 Beta). If your priority is on-page data extraction from those portals, Retrieve is often a stronger fit. For local, human-in-the-loop runs in your own browser, consider the Chrome Browser Extension.
At-a-Glance Comparison
| Rank | Option | Best For | Primary Strength | Watch Out For |
|---|---|---|---|---|
| 1 | Agent API (V1 Beta) | Production portal workflows (login + multi-page forms + uploads) | Command-driven actions in a real remote browser with session_id continuity | Requires backend integration and API key management |
| 2 | Retrieve | Turning dynamic portal pages into structured outputs | Returns JSON arrays of objects with controls for JS-heavy, scroll-heavy UIs | Not a full action agent; you read data, you don’t “click through” flows |
| 3 | Chrome Browser Extension | Local runs, prototyping, and semi-automated portal tasks | Executes agent actions directly in your current Chrome session | Tied to a user’s browser; not a headless backend building block |
Comparison Criteria
We evaluated each option against the following criteria to ensure a fair comparison:
- Workflow reliability: How well it handles real-world portal friction: logins, session continuity, dynamic UIs, and bot protection.
- Implementation overhead: How much application and infrastructure code you need to write and maintain versus the automation you get.
- Data & output control: How easily you can extract structured data (e.g., submitted form snapshots, confirmation screens) as stable JSON for downstream systems.
Detailed Breakdown
1. Agent API (V1 Beta) (Best overall for end-to-end portal workflows)
Agent API (V1 Beta) ranks as the top choice because it lets you describe the workflow in natural language (cmd) and runs it in a secure remote browser session you can keep alive with a session_id, instead of hard-wiring selectors that break with every UI tweak.
At a high level, the pattern is:
- Start a session and log in.
- Keep the same
session_idfor multi-page forms and file uploads. - Let the agent navigate and act on the portal UI in a real browser.
- Optionally, combine with Retrieve for structured confirmation data.
What it does well:
-
Session continuity for logins and multi-page forms
Portal reliability lives and dies on the session. With the Agent API, each call returns a
session_idthat you pass forward:POST https://api.multion.ai/v1/web/browse X_MULTION_API_KEY: YOUR_KEY Content-Type: application/json{ "url": "https://portal.example.com/login", "cmd": "Log in with username 'demo_user' and password 'demo_password', then wait on the dashboard.", "mode": "step" }You’ll get a response that includes something like:
{ "session_id": "sess_123...", "status": "success", "description": "Logged in and waiting on dashboard." }That
session_idis the unit of reliability. Instead of re-logging on each step or relying on Playwright fixtures to keep a browser alive, you keep calling the Agent API with the same session:{ "session_id": "sess_123...", "cmd": "Go to the 'KYC Application' section and start a new application.", "mode": "step" }Multi-page forms become a sequence of
cmds, not a stack of brittle locators. -
Command-driven actions instead of selectors
You stop telling the tool “click
button[data-testid="submit"]” and start telling it “fill out the form with these values and continue to the next step.” Under the hood, the agent drives a real browser:{ "session_id": "sess_123...", "cmd": "On the current form page, fill: 'First Name' = 'Alex', 'Last Name' = 'Lee', 'DOB' = '1990-01-01'. Then click the 'Next' button.", "mode": "step" }If the portal shuffles the layout or changes CSS classes, your workflow remains intent-stable. You’re encoding business logic (“complete KYC section 2”) instead of DOM trivia.
-
File uploads and complex interactions in a real browser
File upload is where traditional automation often goes to die: custom widgets, hidden inputs, drag-and-drop areas, browser-native dialogs. Because MultiOn operates a real remote browser, you describe the upload action and reference the file:
{ "session_id": "sess_123...", "cmd": "Upload the file 'proof_of_address.pdf' to the 'Upload Proof of Address' field and proceed once the upload completes.", "mode": "step", "files": [ { "name": "proof_of_address.pdf", "url": "https://your-backend.example.com/files/proof_of_address.pdf" } ] }The agent handles the UI details of the upload widget. You don’t maintain custom script logic for each portal’s uploader.
-
Designed for production: secure remote sessions, native proxy support
The Agent API is built assuming you’ll put this behind real products, not just demo flows:
- Secure remote sessions: Each browser session is isolated. You’re not reusing some long-lived flaky browser container.
- Native proxy support: You can route agent traffic through proxies to handle “tricky bot protection” portals that rate limit or geofence traffic.
- Explicit error states (including
402 Payment Required): Responses include clear status; you’ll know when billing or limits block executions.
That gives you operational levers you never get from a scattered set of homegrown scripts.
Tradeoffs & Limitations:
-
Backend integration required
You need to own:
- API key management (
X_MULTION_API_KEY). - Session orchestration (
session_idrouting per user/workflow). - Error handling and retries when a step fails.
This isn’t “click-and-forget”; it’s an API you embed in your own backend or worker layer. For teams used to Playwright/Selenium, the mental shift is from “we own the browser” to “we orchestrate agents over HTTP.”
- API key management (
Decision Trigger
Choose Agent API (V1 Beta) if you want to automate portal logins, multi-page forms, and file uploads in production, and you care more about Intent + session_id continuity than about micromanaging selectors.
2. Retrieve (Best for structured data extraction from portal pages)
Retrieve is the strongest fit here because it’s built to take a dynamic, JavaScript-heavy portal page and output a JSON array of objects—useful when your end goal is to capture what the portal shows (submissions, invoices, status tables) rather than to click through the UI.
Retrieve doesn’t run the full action workflow like the Agent API. Instead, you use it alongside or after an Agent API run to extract structured data on demand.
What it does well:
-
JSON arrays of objects from dynamic pages
Where DOM scraping tools choke on lazy-loaded tables or infinite scroll, Retrieve gives you controls:
renderJs: render JavaScript-heavy pages before extraction.scrollToBottom: force scrolling for lazy-loaded lists.maxItems: cap how many objects you want back.
Example: extracting submitted application statuses after your agent completes a form:
POST https://api.multion.ai/v1/web/retrieve X_MULTION_API_KEY: YOUR_KEY Content-Type: application/json{ "url": "https://portal.example.com/applications", "renderJs": true, "scrollToBottom": true, "maxItems": 50 }You’ll get a JSON array of objects—fields like
applicationId,status,submittedAt, etc.—instead of hand-parsed HTML. -
Pairs cleanly with Agent API session flows
The typical pattern for portals:
- Use Agent API to log in and navigate to the correct page (using
session_id). - Once the agent is on the “Applications” or “Uploads” page, call Retrieve (either with the same session-aware URL or a direct authenticated URL, depending on setup).
- Consume the resulting JSON as a stable API surface in your system.
It’s the same pattern as scraping an H&M catalog into structured JSON fields (name, price, colors, URLs, images), just applied to portal data (claims, tasks, invoices).
- Use Agent API to log in and navigate to the correct page (using
Tradeoffs & Limitations:
-
Not a replacement for action agents
Retrieve does not:
- Log in for you.
- Click buttons.
- Fill multi-page forms or upload files.
It’s a data extraction primitive, not a workflow engine. In portal automation, you treat it as “the JSON view” of whatever page your agent ends up on.
Decision Trigger
Choose Retrieve if you already have the workflow under control (via Agent API or existing mechanisms) and your main pain is turning dynamic portal pages into structured JSON arrays of objects for downstream systems.
3. Chrome Browser Extension (Best for local, human-in-the-loop workflows)
The Chrome Browser Extension stands out for this scenario because it lets you run the same “intent-driven browser agent” model but directly in your own Chrome session. That’s ideal when you want to prototype portal automation or assist humans doing the workflow, without yet wiring up a backend integration.
What it does well:
-
Local execution in your browser session
Instead of spinning up a secure remote session, the extension uses your existing browser window:
- Inherits your cookies and authenticated state.
- Works with portals behind corporate SSO or VPN because it’s literally your Chrome.
- Lets you observe what the agent is doing in real time.
You issue natural-language commands similar to the Agent API, but the canvas is the tabs you already have open.
-
Great for designing and testing workflows before going to API
Many teams design their flows by first running them “by hand” in Playwright inspectors. The extension gives you a more direct path:
- Use the extension to iterate on the
cmdinstructions that reliably complete the portal workflow. - Once you’re happy with the sequence, move the same intents into your backend and call
POST https://api.multion.ai/v1/web/browseinstead.
That tightens the loop between human understanding of the portal and your eventual automation.
- Use the extension to iterate on the
Tradeoffs & Limitations:
-
Not optimized for headless, backend scale
The extension:
- Runs in a user’s browser, not as a backend service you can scale to “millions of concurrent AI Agents.”
- Is less suitable for high-volume, parallel portal workflows across many users or tenants.
It’s a prototyping and co-pilot tool, not your long-term execution engine.
Decision Trigger
Choose the Chrome Browser Extension if you want to explore or assist portal workflows in your own browser, validate instructions, or provide in-browser help to operators, and you’re not yet ready to wire up the Agent API in your backend.
How to actually automate a portal workflow without constantly fixing selectors
Let’s put this together into a concrete, reproducible pattern you can implement.
Step 1: Install and set up the Agent API client
In a Node environment, you’d start with:
npm install multion
Grab your X_MULTION_API_KEY from the MultiOn dashboard and configure it in your backend as a secret.
Step 2: Model the workflow as steps, not selectors
Break your portal flow into high-level intents:
- Log in.
- Navigate to the specific workflow (e.g., “New Application”).
- Fill multi-page forms.
- Upload required documents.
- Confirm submission and capture confirmation data.
Each becomes a cmd in Step mode.
Step 3: Implement login and session creation
import { MultionClient } from "multion";
const client = new MultionClient({ apiKey: process.env.MULTION_API_KEY! });
async function loginAndStartSession() {
const res = await client.web.browse({
url: "https://portal.example.com/login",
cmd: "Log in with username 'demo_user' and password 'demo_password'. After login, wait on the main dashboard.",
mode: "step",
});
if (res.status !== "success") {
throw new Error(`Login failed: ${res.status}`);
}
return res.session_id;
}
No selectors, no hard-coded IDs. If the form moves on the page, the intent remains the same.
Step 4: Drive multi-page forms via Sessions + Step mode
async function fillKycForm(sessionId: string) {
await client.web.browse({
session_id: sessionId,
cmd: "From the dashboard, open the 'KYC Application' section and start a new application.",
mode: "step",
});
await client.web.browse({
session_id: sessionId,
cmd: "On this page, fill personal details: First Name 'Alex', Last Name 'Lee', Date of Birth '1990-01-01'. Then click 'Next'.",
mode: "step",
});
await client.web.browse({
session_id: sessionId,
cmd: "On this page, fill address details: Street '123 Main St', City 'San Francisco', Zip '94105'. Then click 'Next'.",
mode: "step",
});
// Continue for as many pages as your workflow needs
}
No loop of await page.click(selector) calls to maintain. The session and high-level instructions carry the state.
Step 5: Handle file uploads as a first-class action
Depending on your environment, you can expose files via URLs or storage. Conceptually:
async function uploadDocuments(sessionId: string) {
await client.web.browse({
session_id: sessionId,
cmd: "Upload the file 'passport.pdf' to the 'Upload Passport' field and wait until the upload finishes.",
mode: "step",
files: [
{
name: "passport.pdf",
url: "https://your-backend.example.com/files/passport.pdf",
},
],
});
await client.web.browse({
session_id: sessionId,
cmd: "Upload the file 'proof_of_address.pdf' to the 'Upload Proof of Address' field and proceed to the review page.",
mode: "step",
files: [
{
name: "proof_of_address.pdf",
url: "https://your-backend.example.com/files/proof_of_address.pdf",
},
],
});
}
Again, no digging for hidden <input type="file"> selectors or hacking around drag-and-drop zones.
Step 6: Confirm submission and optionally extract structured data
After submitting, you can:
-
Use Agent API to confirm:
await client.web.browse({ session_id: sessionId, cmd: "Review the application summary and click 'Submit'. Wait until a confirmation page appears.", mode: "step", }); -
Use Retrieve to extract a structured summary or reference ID:
const confirmationUrl = "https://portal.example.com/application/confirmation"; const confirmationData = await client.web.retrieve({ url: confirmationUrl, renderJs: true, scrollToBottom: false, maxItems: 1, }); // confirmationData is a JSON array of objects—store it in your DB/logs
You now have a stable, JSON-level record of what the portal actually showed.
Why this approach stops the selector treadmill
Traditional portal automation fails for three repeatable reasons:
-
Selectors are the wrong abstraction.
You’re binding to implementation details (DOM, CSS classes, test IDs) instead of the workflow’s intent (log in, complete KYC, upload docs). -
Sessions aren’t a first-class concept.
You fight cookies, fixtures, and retries instead of having a dedicatedsession_idprimitive exposed by the platform. -
Dynamic rendering and bot protection are second-class concerns.
You end up building your own remote Chrome farm, proxy management, and anti-bot choreography around the script.
MultiOn leans into those exact pain points:
- Intent in:
cmdstrings describe what to do, not how to hunt for DOM elements. - Actions executed in a real browser: A secure remote session with native proxy support handles logins, dynamic UIs, and bot checks.
- Structured JSON out: Retrieve turns the end-state pages into JSON arrays of objects, so your application never has to parse HTML.
You stop “fixing selectors” and start owning workflows at the level you actually care about.
Final Verdict
If your goal matches the slug—automate a portal workflow (login, multi-page forms, file uploads) without constantly fixing selectors—the decision framework is:
- Use Agent API (V1 Beta) as your primary automation surface. Treat
session_idas your unit of reliability and encode workflow steps ascmds instead of selectors. - Layer Retrieve where you need reliable, structured JSON outputs from dynamic portal pages—submissions, status lists, confirmations.
- Use the Chrome Browser Extension to prototype and validate instructions locally before you commit them to your backend.
That combination gives you a selector-free, session-aware automation stack that behaves like a robust backend service instead of a fragile pile of scripts.