lmwebtest reference

Complete reference for lmwebtest command-line subcommands and flags, environment variables, Web DSL types and methods, Playwright host handle types, and exit codes.

Command-line subcommands and flags

Command or flag Purpose
lmwebtest --version | -v Print lmwebtest X.Y.Z to stdout and exit 0
lmwebtest --lmcode-schema [--json] Print human-readable Web DSL schema summary or exact lmwebtest.dsl.json bytes (--json) and exit 0
lmwebtest --lmcode-signatures Print canonical sorted Web DSL method and function signatures and exit 0
lmwebtest [--dry-run] --lmcode FILE Execute (or validate in dry-run mode) a compiled Web DSL bytecode file
lmwebtest playwright --lmcode-schema [--json] Print human-readable signatures or exact JSON schema (--json) for the full Playwright lmcode host
lmwebtest playwright --lmcode-signatures Print canonical sorted signatures for the full Playwright lmcode host
lmwebtest playwright --lmcode FILE [--lmcode FILE2 ...] Execute one or more compiled Playwright host bytecode files in a synchronous worker-bridged session
lmwebtest test <url> [--status 200] [--title TEXT] [--selector CSS] [--timeout 10000] Load url in Chromium, check status, title, visible selectors, console/page/network errors, and broken images, and output JSON
lmwebtest screenshot <url> --out <file.png> [--no-js] [--timeout 10000] Capture a full-page PNG screenshot of url (optionally with JavaScript disabled via --no-js) and output JSON
lmwebtest init <site-name> [--url <url>] Create a starter Playwright site test configuration under sites/<site-name>
lmwebtest run [site-id|file|dir] [options] Run Playwright test suites for a specific site directory or spec file (checkout mode only)
lmwebtest batch | lmwebtest run --all Run Playwright test suites across all configured directories under sites/ (checkout mode only)

Environment variables

Variable Default Description
LMCODE_HEADED unset (0) Set to 1 to launch Playwright Chromium in headed (visible window) mode during lmwebtest playwright runs
LMCODE_JS vendored Optional filesystem path to an external lmcode-js checkout overriding the vendored runtime
LMCODE_INVOCATION_FILE unset Internal SDK invocation envelope path supplied automatically by run_lmcode

Web DSL context objects (cli="lmwebtest")

Name Type Description
web Web Root browser session controller for navigating to pages and configuring viewport, headers, user agent, and timeouts
report Report Structured finding collector for recording assertion failures and exporting JSON or text reports

Web DSL types and methods (schema/lmwebtest.dsl.json)

Type Method signature Description
Web Web.navigate(url: string) -> Page Launch Chromium if needed, navigate to url waiting for load, and return a Page handle
Web Web.navigate(url: string, timeout_ms: int) -> Page Navigate to url with an explicit navigation timeout in milliseconds
Web Web.set_timeout(timeout_ms: int) -> void Set the default operation timeout in milliseconds for subsequent navigations and waits
Web Web.set_viewport(width: int, height: int) -> void Set the browser viewport dimensions in pixels (default 1280x720)
Web Web.set_user_agent(ua: string) -> void Set a custom User-Agent string for browser contexts
Web Web.set_header(name: string, value: string) -> void Add an extra HTTP request header sent with browser requests
Web Web.close() -> void Close all open pages and shut down the Chromium browser instance
Page Page.url() -> string Return the current page URL after redirects
Page Page.title() -> string Return the current document title
Page Page.status() -> int Return the HTTP status code of the main navigation response
Page Page.html() -> string Return the full serialized HTML content of the live DOM
Page Page.html(selector: string) -> string Return the outer HTML of the first element matching selector
Page Page.save_html(path: string) -> void Write the full rendered DOM HTML to path (creating parent directories as needed)
Page Page.screenshot(path: string) -> void Capture a full-page PNG screenshot to path
Page Page.screenshot(path: string, full_page: bool) -> void Capture a PNG screenshot to path with configurable full_page behavior
Page Page.wait_for(selector: string) -> Element Wait for selector to appear in the DOM and return the matched Element
Page Page.wait_for(selector: string, timeout_ms: int) -> Element Wait up to timeout_ms milliseconds for selector to appear and return the Element
Page Page.wait_for_timeout(ms: int) -> void Pause execution for ms milliseconds
Page Page.wait_for_load() -> void Wait for the page load state to complete
Page Page.select(selector: string) -> ElementList Return an ElementList of all elements matching CSS selector
Page Page.select_one(selector: string) -> Element Return the first Element matching CSS selector
Page Page.has(selector: string) -> bool Return true if at least one element matches CSS selector
Page Page.count(selector: string) -> int Return the number of elements matching CSS selector
Page Page.text(selector: string) -> string Return the text content of the first element matching CSS selector
Page Page.inner_html(selector: string) -> string Return the inner HTML of the first element matching CSS selector
Page Page.outer_html(selector: string) -> string Return the outer HTML of the first element matching CSS selector
Page Page.click(selector: string) -> void Click the first element matching CSS selector
Page Page.fill(selector: string, value: string) -> void Fill a form control matching CSS selector with value
Page Page.press(selector: string, key: string) -> void Press keyboard key on the first element matching CSS selector
Page Page.eval(script: string) -> string Evaluate a JavaScript expression in the page context and return its stringified result
Element Element.text() -> string Return the text content of this element
Element Element.inner_html() -> string Return the inner HTML of this element
Element Element.outer_html() -> string Return the outer HTML of this element
Element Element.attr(name: string) -> string Return the value of attribute name (or empty string if absent)
Element Element.has_attr(name: string) -> bool Return true if attribute name is present on this element
Element Element.is_visible() -> bool Return true if this element is currently visible
Element Element.click() -> void Click this element
Element Element.fill(value: string) -> void Fill this form element with value
Element Element.press(key: string) -> void Press keyboard key on this element
Element Element.select(selector: string) -> ElementList Query descendant elements matching CSS selector
Element Element.select_one(selector: string) -> Element Query the first descendant element matching CSS selector
Element Element.count(selector: string) -> int Count descendant elements matching CSS selector
ElementList ElementList.len() -> int Return the number of elements in the list
ElementList ElementList.at(index: int) -> Element Return the Element at 0-based index
ElementList ElementList.texts() -> StrList Return a StrList of text contents for all elements in the list
Report Report.add(rule: string, selector: string, line: int, message: string) -> void Record a validation finding in the report
Report Report.fail_if_any() -> void Raise a run failure if one or more findings have been added to the report
Report Report.write_json(path: string) -> void Write all recorded findings to path as a JSON array
Report Report.write_text(path: string) -> void Write all recorded findings to path as line-oriented text

Web DSL global functions

Function signature Description
print(message: string) -> void Write a diagnostic message line to stderr
assert_close(actual: float, expected: float, tolerance: float) -> void Assert that actual and expected agree within absolute tolerance

Playwright host handle types (cli="lmwebtest playwright")

Handle type Representative methods Description
Playwright (context pw) launch, connect, env, call Root entry point for launching or connecting to browsers and reading environment variables
Browser new_context, new_page, contexts_count, version, is_connected, close Browser process handle supporting isolated contexts and direct pages
BrowserContext new_page, add_cookies, storage_state, route_fulfill, tracing_start, tracing_stop, close Isolated browser profile managing cookies, storage state, network routing, and tracing
Page goto, locator, click, fill, press, set_input_files, click_response, click_download, click_popup, screenshot, evaluate, close Browser tab supporting navigation, input actions, file uploads, event-synchronized clicks, and assertions
Frame goto, locator, click, fill, text_content, evaluate, url, name Iframe or main frame execution target
Locator locator, first, nth, count, click, fill, set_input_files, text_content, get_attribute Auto-waiting Playwright locator for resilient element interactions and retrying assertions
Request / Response url, method, status, text, json Captured network request and response handles
Download / FileChooser / Dialog suggested_filename, save_as, set_files, message, accept, dismiss Handles for browser downloads, file-chooser interceptions, and alert/confirm/prompt dialogs
ApiContext / ApiResponse get, post, put, delete, fetch, status, text, dispose Direct HTTP client sharing or testing endpoints alongside browser contexts
Object (all handles) id() -> int, call(path: string, argsJson: string) -> string, call_id(path: string, argsJson: string) -> int, release() -> void Universal handle reflection reaching any Playwright method or nested object by dotted path

Exit codes

Exit code Mode Meaning
0 All modes All checks, screenshots, or bytecode programs completed without error
1 CLI (test / screenshot / run / batch) Page check failed (status mismatch, console/page/network error, missing selector, broken image) or Playwright test suite failed
2 All modes Invalid command-line arguments, unknown subcommand, or malformed URL/timeout/status option
3 lmcode hosts (--lmcode / playwright --lmcode) Bytecode load error, schema mismatch, Playwright browser/action failure, or report.fail_if_any() triggered
4 lmcode hosts Application error raised with code APP_FAIL