appium-live-view (Python)
Build a standalone, interactive HTML live view — the Appium Inspector experience (hover to highlight, click to inspect attributes + locators, a selectable source tree, an XPath tester) — from a page source (XML) + screenshot. No server, no browser, no Node: one function returns a self-contained HTML string you can attach to Allure or save anywhere.
It's the Python counterpart of the Appium plugin / JS renderer.
The interactive CSS + JS are shared verbatim with the JS renderer (generated by
tools/extract-assets.mjs), so both produce the same live view.
Install
pip install ./python # from this repo
# or, once published:
pip install appium-live-view
Use
from appium_live_view import build_live_view_html
import allure
html = build_live_view_html(
driver.page_source, # XML string
driver.get_screenshot_as_png(), # raw PNG bytes (also accepts base64 or a data: URI)
title="Login screen",
platform_name=driver.capabilities.get("platformName"),
)
allure.attach(html, "Live view", allure.attachment_type.HTML)
A pytest failure hook is a natural home:
import pytest, allure
from appium_live_view import build_live_view_html
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
driver = getattr(item.instance, "driver", None)
if report.when == "call" and report.failed and driver is not None:
html = build_live_view_html(driver.page_source, driver.get_screenshot_as_png())
allure.attach(html, "Live view", allure.attachment_type.HTML)
API
build_live_view_html(xml=None, screenshot=None, *, title=None, platform_name=None, selected_path=None, context=None, webview_rect=None, mode=None, parsed=None) -> str
xml— Appium page source (driver.page_source).screenshot— raw PNGbytes, a base64str, or a fulldata:URI. Optional (overlays still work without it).selected_path— dot-separated node path to pre-select (e.g. the element a step acted on).context—"web"/"native"to force locator style + coordinate handling (else auto-detected from the snapshot root).webview_rect—{"x", "y", "width", "height"}in CSS px: the WebView's on-screen rectangle, for a full-device screenshot (iOS Safari / a hybrid WebView below a native bar). Overlays are offset byx/y. Not needed for a web-viewport screenshot (Android Chrome).mode—"js"to emit a near-empty shell (screenshot + embedded source + runtime) and rebuild the overlays/tree/panels on load instead of pre-rendering them. Much smaller on large pages, but needs JavaScript — the attachment opened standalone, or the Allure report patch inline. Default is the pure-CSS view that also works with no JS.
Also exported: parse_source, parse_coordinates, suggest_locators,
absolute_xpath, and WEB_SNAPSHOT_JS.
WebView / hybrid context
In a WebView context driver.page_source is HTML without coordinates. Run the
DOM snapshot script in the webview to capture tags + attributes + bounds, then
render with context="web" (CSS + DOM-XPath locators):
from appium_live_view import WEB_SNAPSHOT_JS, build_live_view_html
source = driver.execute_script(WEB_SNAPSHOT_JS) # in the webview context
html = build_live_view_html(source, driver.get_screenshot_as_png(), context="web")
The snapshot records on-device geometry (devicePixelRatio, viewport, screen
size), so overlays scale per device and a web-viewport screenshot (Android
Chrome) lines up automatically. A full-device screenshot (iOS Safari, or a
hybrid WebView below a native bar) has the web content offset from the top; that
offset isn't visible to the page, so pass the WebView's on-screen rectangle (CSS
px, e.g. from Appium's native context) as webview_rect:
html = build_live_view_html(
source, driver.get_screenshot_as_png(), context="web",
webview_rect={"x": 0, "y": 59, "width": 393, "height": 659},
)
Notes
- Interactivity inline in Allure 3: hover and click-to-pin and the source tree
are pure CSS and work inline; copy, the XPath tester and the download buttons
need JavaScript, which Allure strips from inline attachments. Open the attachment
standalone, or apply the report patch in
../examples/allure-inline-interactive/. - Requires Python 3.8+, no third-party dependencies.
Release files for appium-live-view 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| appium_live_view-0.1.4.tar.gz | 29.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| appium_live_view-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 54.3 kB
Release files / appium_live_view-0.1.4.tar.gz
| Download URL | appium_live_view-0.1.4.tar.gz |
|---|---|
| Size | 29.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca4c9e56939f323fb06867a6d4f20402f646a85418309a51f5d43929ae0df891
|
|
BLAKE2b-256 checksum How to use checksums |
70885c540568998641c06afa292fabf0109f126dba0a5b80cd2633f800fc6e9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Artix Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / appium_live_view-0.1.4-py3-none-any.whl
| Download URL | appium_live_view-0.1.4-py3-none-any.whl |
|---|---|
| Size | 25.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
800680ced262ed1592eccd2c6dded74a47075f4ac5a972d1d43c122d9776e631
|
|
BLAKE2b-256 checksum How to use checksums |
737fe88b1a5d2f948db895bf6f1a1d26fa0f2daf6f27a63f7c06ff2bf5ca899a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Artix Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|