Prompt

How do I automate login and navigation in browser-based portals?

Technology / Low-Code / No-Code1 observationLast seen Nov 6, 2026

Latest observation

Nov 6, 2026OpenAI APIWeb search: off

Automating login and navigation in browser-based portals is usually done with browser automation tools such as Playwright, Selenium, or Puppeteer. The best approach depends on whether you need simple form filling, complex multi-step navigation, or robust unattended runs.

1) Pick the right tool

  • Playwright: modern, fast, reliable, great for dynamic sites and multi-browser support.
  • Selenium: widely used, good ecosystem, works with many languages.
  • Puppeteer: strong for Chrome/Edge automation, JavaScript-focused.

If you’re starting fresh, Playwright is often the easiest and most reliable.

2) Typical automation flow

  1. Open the portal URL.
  2. Wait for the login form to load.
  3. Fill username and password fields.
  4. Handle any extra steps:
    • MFA/2FA
    • CAPTCHA
    • SSO redirect
    • “Remember this device” prompts
  5. Click sign in.
  6. Wait for the post-login page.
  7. Navigate to the required section.
  8. Extract data or perform actions.
  9. Save session state if you want to avoid logging in every time.

3) Example with Playwright (JavaScript)

const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch({ headless: false });
  const page = await browser.newPage();

  await page.goto('https://portal.example.com/login');

  await page.fill('#username', process.env.PORTAL_USER);
  await page.fill('#password', process.env.PORTAL_PASS);
  await page.click('button[type="submit"]');

  await page.waitForLoadState('networkidle');

  await page.goto('https://portal.example.com/dashboard/reports');
  // do more navigation or extraction here

  await browser.close();
})();

4) Handling login challenges

Multi-factor authentication

If the portal uses MFA:

  • Use official APIs or service accounts if available.
  • If allowed, use a human-in-the-loop step to enter the code.
  • For repeated automation, some portals support trusted devices or app passwords.

CAPTCHA

CAPTCHAs are intentionally designed to block automation. Avoid trying to bypass them. Instead:

  • Use the provider’s API if available.
  • Request an automation-friendly access method from the portal owner.
  • Use manual intervention when needed.

SSO / federated login

For SSO systems like Okta, Azure AD, or Google Workspace:

  • Automate the full redirect chain carefully.
  • Sometimes storing authenticated session state works better than logging in each time.
  • You may need to handle popup windows or same-site cookie restrictions.

5) Make it reliable

  • Use stable selectors:
    • Prefer data-testid, aria-label, or unique IDs.
    • Avoid brittle XPath tied to layout.
  • Add explicit waits:
    • Wait for elements to appear before interacting.
    • Wait for navigation after clicking login.
  • Handle errors and retries:
    • Network failures
    • Session timeout
    • Unexpected modals
  • Run with environment variables or a secret manager for credentials.
  • Log actions for debugging.

6) Save and reuse sessions

Many portals allow session reuse:

  • In Playwright, save storage state after login.
  • Reuse cookies/local storage on later runs.

Example:

// After login
await page.context().storageState({ path: 'state.json' });

Then later:

const context = await browser.newContext({ storageState: 'state.json' });
const page = await context.newPage();

7) Security and compliance

  • Check the portal’s terms of service and your organization’s policies.
  • Don’t store passwords in source code.
  • Use secrets managers or encrypted environment variables.
  • Limit automation privileges to what’s necessary.

8) When to use APIs instead

If the portal has an API, prefer it over browser automation. APIs are:

  • Faster
  • More reliable
  • Easier to maintain
  • Less likely to break when the UI changes

If you want, I can give you:

  1. a Playwright script template,
  2. a Selenium example, or
  3. help with a specific portal flow like SSO/MFA.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.