Chrome DevTools Protocol client for browser automation
Find a file
Snider fed7e1ae26
Some checks failed
security-scan.yml / refactor(webview): migrate New + NewCDPClient to core.Result (Mantis #1390) (push) Failing after 0s
test.yml / refactor(webview): migrate New + NewCDPClient to core.Result (Mantis #1390) (push) Failing after 0s
refactor(webview): migrate New + NewCDPClient to core.Result (Mantis #1390)
Both constructors now return core.Result instead of (*T, error). Bodies
wrap their explicit error branches in core.Fail and the happy path in
core.Ok; a top-level defer-recover converts unexpected panics into
Result.Fail so the caller sees one consistent contract regardless of
failure mode.

This is the proof file for Mantis #1389 — the canonical (*T, error) →
core.Result migration umbrella across the canonical Go repos. Once the
shape validates here, propagation continues to go-pool, go-forge,
go-scm, lem, BugSETI per the umbrella's per-repo decomposition.

Changes:
- cdp.NewCDPClient: signature → core.Result, defer-recover, explicit
  Fail/Ok at every branch, boundary marker stripped, docstring
  AX-tightened with Result-shape example.
- webview.New: same shape; existing cleanupOnError flow preserved.
- WithDebugURL Option: internal call to NewCDPClient now consumes
  Result; Option's outer error contract preserved (sister-concern
  scope per #1389 note).
- service.go NewService factory: callsite migrated to Result chain.
- service.go Register docstring: late-wire example now uses Result
  shape, AX-tightened.
- All in-repo tests (cdp_test, webview_test, webview_methods_test,
  audit_issue2_test): callsites migrated. 11 happy-path NewCDPClient
  callers + 3 negative-test variants + 3 webview.New callers.

Verification:
- GOWORK=off go vet ./... clean
- GOWORK=off go test -count=1 -timeout=60s ./... clean
- 9 happy-path test callsites collapsed via replace_all (identical
  shape, safe single-pattern edit)

Mantis #1390 (child of #1389).

Co-Authored-By: Virgil <virgil@lethean.io>
2026-05-11 05:41:14 +01:00
.core chore: add .core/ build and release configs 2026-03-06 18:52:37 +00:00
.forgejo/workflows ci: add Forgejo Actions test and security scan workflows 2026-02-23 03:28:08 +00:00
docs fix(webview): use protocol-correct history navigation 2026-04-15 14:23:44 +01:00
go refactor(webview): migrate New + NewCDPClient to core.Result (Mantis #1390) 2026-05-11 05:41:14 +01:00
specs fix(console): bound exception retention 2026-04-16 00:19:04 +01:00
tests/cli/webview feat(go-webview): add CLI test Taskfile for build and unit test validation (AX-10) 2026-04-24 15:08:46 +01:00
.editorconfig chore: add Go repo norms (badges, contributing, lint, taskfile, editorconfig) 2026-02-23 06:45:50 +00:00
.gitignore chore(repo): untrack build artifacts + scan caches (audit dim tracked-artifacts) 2026-05-01 10:35:05 +01:00
.golangci.yml chore: add Go repo norms (badges, contributing, lint, taskfile, editorconfig) 2026-02-23 06:45:50 +00:00
AGENTS.md refactor(go): restructure to /go/ subtree + audit COMPLIANT (Mantis #1254) 2026-05-01 02:35:11 +01:00
CLAUDE.md chore: migrate to dappco.re vanity import path 2026-03-21 23:45:30 +00:00
CONTRIBUTING.md chore: add Go repo norms (badges, contributing, lint, taskfile, editorconfig) 2026-02-23 06:45:50 +00:00
go.work chore(repo): refresh submodules + go.work hygiene (Phase 2 cascade unblock) 2026-05-01 09:41:39 +01:00
LICENCE chore: add EUPL-1.2 LICENCE file (UK English canonical) 2026-05-01 08:35:19 +01:00
README.md docs(api): add exported contract matrix 2026-03-23 15:27:05 +00:00

Go Reference License: EUPL-1.2 Go Version

go-webview

Chrome DevTools Protocol (CDP) client for browser automation, testing, and scraping. Connects to an externally managed Chrome or Chromium instance running with --remote-debugging-port=9222, providing navigation, DOM queries, click and type actions, console capture, JavaScript evaluation, screenshots, multi-tab support, viewport emulation, and a fluent ActionSequence builder. Includes Angular-specific helpers for Zone.js stability, router navigation, component introspection, and ngModel access.

Module: dappco.re/go/core/webview Licence: EUPL-1.2 Language: Go 1.25

Quick Start

import "dappco.re/go/core/webview"

wv, err := webview.New(webview.WithDebugURL("http://localhost:9222"))
defer wv.Close()

wv.Navigate("https://example.com")
wv.Click("#submit")
wv.Type("#input", "search term")
png, err := wv.Screenshot()

// Fluent action sequence
err = webview.NewActionSequence().
    Navigate("https://example.com").
    WaitForSelector("#login-form").
    Type("#email", "user@example.com").
    Click("#submit").
    Execute(ctx, wv)

Documentation

  • API Contract — exported API inventory with signatures and current test coverage
  • Architecture — CDP connection, DOM queries, console capture, Angular helpers, action system
  • Development Guide — prerequisites, build, test patterns, adding actions
  • Project History — completed phases, known limitations, future considerations

Build & Test

go test ./...
go vet ./...
go build ./...

Licence

European Union Public Licence 1.2 — see LICENCE for details.