LOGIN¶
Resolve each credential field via the 7-strategy SelectorResolver, fill, submit, validate.
| Always-on? | Yes (ifLoginAlways) |
| Owner slot | login: Option<{ activeFrame, persistentOtpToken, urlBeforeSubmit }> |
| Source | LoginPhase.ts + LoginPhaseActions.ts |
7-strategy SelectorResolver¶
The mediator resolves each field declared in the bank's LoginConfig by trying these in order, stopping at the first match:
- Visible text (label / button text in Hebrew or English)
textContentwalk-up from the visible text node to the nearest interactive ancestorplaceholderattributearia-labelnameattribute- CSS selector (rarely needed — declarative
LoginConfigshould avoid it) - XPath fallback
Once the first field is resolved, FormAnchor scopes the remaining fields to the discovered <form> so multi-form pages don't cross-pollute.
Sub-step contract¶
| Hook | What it does |
|---|---|
.pre | Resolve LoginConfig for the bank; record urlBeforeSubmit. |
.action | Resolve every field; fill; click submit; wait for URL change OR known-error indicator. |
.post | Detect INVALID_PASSWORD / WRONG_DETAILS / LOGIN_FAILED markers in the post-submit page; consult possibleResults map. |
.final | Commit login slot with activeFrame + persistentOtpToken (if exposed). |
Failure modes¶
errorType | Cause |
|---|---|
INVALID_PASSWORD | Wrong credentials — typed correctly, just wrong |
WAF_BLOCKED | Cloudflare challenge after submit — see errorDetails.suggestions |
TIMEOUT | Submit succeeded but post-login navigation didn't complete |
CHANGE_PASSWORD | Bank requires password change before continuing |
Phase 12d — Form/Anchor/ & Form/ErrorDiscovery/ sub-modules¶
Phase 12d split FormAnchor.ts and FormErrorDiscovery.ts into focused sub-modules under src/Scrapers/Pipeline/Mediator/Form/. Each sub-module fits the canonical CLEAN_CODE.md cap-10 ESLint ceiling (no new §19.4b grandfathers per pr-guidlines.md A3.5.2). Browser-context work is decoupled into dedicated *Browser.ts files so every closure can be a single querySelectorAll(sel).map(...) while Node-side bridges fan out parallel evaluateAll / evaluate calls and zip the resulting columns back into typed records.
Anchor (Form/Anchor/)¶
Selector-safe primitives used when emitting CSS / XPath strings from DOM-derived values (CR PR #345 findings #175 + #179, OWASP A03 — selector injection):
escapeCssIdent— escape a CSS identifier (id / class).escapeCssAttr— escape a CSS attribute-value (between"…").toXpathLiteral— turn arbitrary text into a quoted XPath literal (handles'and"viaconcat()).
Each helper returns a nominal brand type (Rule #15 — no raw primitive returns at module boundaries). The brand carries the same runtime string; the tag prevents accidentally feeding an unescaped string back into a selector composition:
CssIdent— branded return ofescapeCssIdent.CssAttr— branded return ofescapeCssAttr.XPathLiteral— branded return oftoXpathLiteral.
Browser closures + column transport (consumed by AnchorWalk.ts):
getAncestorTags— column ofElement.tagNameper ancestor.getAncestorIds— column ofElement.id.getAncestorFormFlags— boolean column (tagName === 'FORM').getAncestorInputCounts— numeric column of<input>descendants.getAncestorNames— column ofnameattributes.getAncestorStableClasses— first non-ng-*class per ancestor.getAncestorSibInfos—{index, count}of same-tag siblings.IAncestorColumns— flat-column transport shape from browser to Node.ISibInfo— single-sibling positional info record.
ErrorDiscovery (Form/ErrorDiscovery/)¶
Detach-tolerance helper used by every error-discovery probe so benign Playwright detach / context-destroyed rejections fall through to "no errors" while real bugs still surface (CR PR #345 findings #183, #186):
DETACHED_PATTERNS— substring catalogue of Playwright detach prose (incl.Frame detached).isElementGoneError— predicate overunknownrejections; returnstruefor benign signals.DetachedSignal— branded boolean returned byisElementGoneError(Rule #15 — no rawbooleanreturn at module boundaries).
Browser closures + column transport (consumed by ErrorDiscoveryScan.ts):
getErrorTags— lowercase tag column of every matched error element.getErrorClasses— class-attribute column (ornoClasssentinel).getErrorTexts— trimmedtextContentcolumn.getErrorHidden— boolean column derived from computed style.IErrorColumns— flat-column transport shape from browser to Node.IErrorClassesArg—{sel, noClass}bundle accepted bygetErrorClasses.