Skip to main content

Build a standalone, interactive HTML live view from an Appium page source (XML) + screenshot

Project description

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, parsed=None) -> str

  • xml — Appium page source (driver.page_source).
  • screenshot — raw PNG bytes, a base64 str, or a full data: URI. Optional (overlays still work without it).
  • selected_path — dot-separated node path to pre-select (e.g. the element a step acted on).

Also exported: parse_source, parse_coordinates, suggest_locators, absolute_xpath.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

appium_live_view-0.1.1.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

appium_live_view-0.1.1-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file appium_live_view-0.1.1.tar.gz.

File metadata

  • Download URL: appium_live_view-0.1.1.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for appium_live_view-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5b4094494c254bfc4baed5e6bf978ce6ce8616bec97ab636e8f1abdd5861ac6c
MD5 93272006c7aca9bc182b6992017deddd
BLAKE2b-256 8add84f1bde920b61093eee6182f476dc60ab5cd562da542bd8334666ad508c9

See more details on using hashes here.

File details

Details for the file appium_live_view-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: appium_live_view-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for appium_live_view-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a4ac2a4ef1cca8d2284988ed7f7d3cc5239dbd9ebfbe487639e9da31c8bc9672
MD5 7e367fd0893167d8af6f8fbca5701dd2
BLAKE2b-256 7377deef963f1894e7ae56dc6b22aa2b1db54e55b3ca3b4d2ffb64e4688dc254

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page