Auth login times out when a page has a hidden copy of the login form before the visible one

Author: pcomansCreated Sep 26, 2026Updated Sep 26, 2026

auth login fails with Timed out waiting for username field on pages that render a hidden duplicate of the login form before the visible one. LinkedIn's login page (https://www.linkedin.com/login) is one example. Auto-detection seems to pick the first element matching the preferred selectors even when it isn't visible, wait for it to become visible, and then fall back to selectors (input[type=text], input:not([type])) that don't match type="email" fields.

Repro (agent-browser 0.38.1, Linux, headless Chrome 154)

index.html, served with python3 -m http.server 8765:

xml
<!doctype html><title>repro</title>
<div style="display:none"><input type="email" autocomplete="username"><input type="password"><button>Sign in</button></div>
<div><input type="email" autocomplete="username webauthn"><input type="password"><button type="submit" onclick="document.title='signed in'">Sign in</button></div>
bash
printf %s pw | agent-browser auth save repro --url http://localhost:8765/ --username [email protected] --password-stdin
agent-browser auth login repro

Actual: after about 25 seconds:

Timed out waiting for username field (preferred selectors for 5000ms: input[type=email], input[name=email], …; fallback selectors for 20000ms: input[type=text], input:not([type]))

Expected: fills the visible form and submits.

With explicit selectors, the same profile signs in successfully (document.title becomes signed in):

bash
agent-browser auth login repro \
  --username-selector "input[autocomplete~=webauthn]" \
  --password-selector "div:nth-of-type(2) input[type=password]" \
  --submit-selector "div:nth-of-type(2) button"

Suggested fix

  • When detecting fields, only consider visible, enabled elements (for example, the first match with a non-empty bounding box), for username, password, and submit alike.
  • Have the fallback include input[type=email], or reuse the preferred list with a visibility filter.
  • It would also help if the timeout error said when matches existed but were all hidden. That would point users straight at the selector flags.

Source: vercel-labs/agent-browser