Skip to content

Screen & UI ​

Screenshot ​

pb screencap

Take a screenshot of the device screen. The image is saved locally in JPG format (quality 80).

Screenshots are saved to: .phonebase/screencap/{YYYYMMDD}/{device_code}-{timestamp}.jpg

TIP

In terminals that support inline images (iTerm2, Kitty), a preview is displayed directly in the terminal.

Example:

bash
pb screencap
text
✓ Screenshot saved: .phonebase/screencap/20250115/IDY291LX6WW6RCW-20250115143022.jpg
json
{
  "code": 200,
  "data": {
    "path": ".phonebase/screencap/20250115/IDY291LX6WW6RCW-20250115143022.jpg",
    "size": 45678
  },
  "msg": "Screenshot saved: .phonebase/screencap/20250115/IDY291LX6WW6RCW-20250115143022.jpg"
}

UI Dump ​

pb dump

Dump the full UI hierarchy as indented XML. Useful for understanding the screen structure.

Example:

bash
pb dump

Human Output (excerpt):

xml
<node class="android.widget.FrameLayout" bounds="[0,0][1080,2400]">
  <node class="android.widget.LinearLayout" bounds="[0,0][1080,2400]">
    <node class="android.widget.TextView" text="Hello" bounds="[100,200][300,250]" />
  </node>
</node>

Compact UI Dump ​

pb dumpc

Dump a compact version of the UI hierarchy. Less verbose than pb dump, focusing on key attributes.

Example:

bash
pb dumpc

UI Inspector ​

pb inspect [device_id] [--text] [--image]

Generate an interactive UI inspection report. Creates an HTML file with a dual-panel view: wireframe diagram and annotated screenshot with clickable hotspots.

ParameterTypeRequiredDescription
device_idstringNoDevice ID. Defaults to connected device
--textflagNoOutput only the wireframe (skip screenshot annotation)
--imageflagNoOutput only the annotated screenshot (skip wireframe)

Output files are saved to: .phonebase/inspect/{YYYYMMDD}/{timestamp}/

The output directory contains:

  • *-inspect.html -- Interactive HTML inspector (open in browser)
  • *-screenshot.jpg -- Raw screenshot
  • *-layout.xml -- Raw UI hierarchy XML

Example:

bash
pb inspect
text
✓ Inspection complete
  inspect:    .phonebase/inspect/20250115/IDY291LX6WW6RCW-20250115143022-inspect.html
  screenshot: .phonebase/inspect/20250115/IDY291LX6WW6RCW-20250115143022-screenshot.jpg
  layout:     .phonebase/inspect/20250115/IDY291LX6WW6RCW-20250115143022-layout.xml
json
{
  "code": 200,
  "data": {
    "inspect": ".phonebase/inspect/20250115/IDY291LX6WW6RCW-20250115143022-inspect.html",
    "screenshot": ".phonebase/inspect/20250115/IDY291LX6WW6RCW-20250115143022-screenshot.jpg",
    "layout": ".phonebase/inspect/20250115/IDY291LX6WW6RCW-20250115143022-layout.xml"
  },
  "msg": "Inspection complete"
}

TIP

Open the -inspect.html file in a browser (Cmd+Click in most terminals) for an interactive view where you can hover over elements to see their properties.

Display Info ​

pb display

Get the screen resolution and rotation of the device.

Example:

bash
pb display
text
Width: 1080  Height: 2400  Rotation: 0
json
{
  "code": 200,
  "data": {
    "width": 1080,
    "height": 2400,
    "rotation": 0
  },
  "msg": "OK"
}

Clipboard ​

pb clipboard [text]

Get or set the device clipboard content. Without arguments, returns the current clipboard text. With a text argument, sets the clipboard.

ParameterTypeRequiredDescription
textstringNoText to set. Omit to read the current clipboard

Examples:

bash
# Get clipboard content
pb clipboard

# Set clipboard content
pb clipboard "Hello World"

Open URL ​

pb browse <url>

Open a URL in the device's browser. Tries browsers in priority order: Via > Via GP > Chrome > system default.

ParameterTypeRequiredDescription
urlstringYesURL to open

Example:

bash
pb browse "https://example.com"