CodeVetter · Repo Unpack · Data flow
webdriverio/webdriverio
Configuration is executable input that becomes launcher scheduling state and is reconstructed in each worker. Session requests transform requested capabilities into negotiated capabilities and protocol-specific client state. Element lookup preserves references and selectors so middleware can recover from missing or stale elements. Outputs cross distinct boundaries: IPC reporting, driver HTTP/WebSocket traffic, local artifact files, and optional loopback shared-store requests.
- ConfigParser.initialize loads the configuration module once, merges overrides, and applies CLI headless settings; addConfigFile extracts capabilities and hooks before deep-merging remaining configuration.
- getSpecs resolves configured files, applies capability specs unless CLI --spec is present, combines requested suites, deduplicates, conditionally repeats, filters exclusions, and then shards.
- Launcher structured-clones capabilities for each worker, runs onWorkerStart hooks, and passes configuration path, selected specs, credentials, execArgv, and retries to runner.run.
- startWebDriverSession converts flat capabilities to alwaysMatch/firstMatch, requests BiDi except for enforced Classic or Safari, normalizes overlaps, sends POST /session, and writes negotiated capabilities back to params.
- Protocol command wrappers validate arguments, encode endpoint variables, construct an unmasked request body, produce masked event/log payloads, and delegate execution to environment.value.Request.
- getElement converts protocol references into client objects containing elementId, selector, parent, and optional BiDi locator; the element command wrapper uses these fields for waiting and stale-reference recovery.
- Worker browser command/result events become reporter events; BaseReporter fans out events, sends output through IPC when available, and shutdown waits for reporter synchronization before emitting exit.
- Shared-store launcher startup injects the server port into capabilities; worker service setup installs browser.sharedStore, whose client serializes JSON over loopback HTTP into an object store or resource-pool Map.