inspect

package
v0.1.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package inspect serves droidline inspect: a local page that shows a phone's screen and element tree, suggests selectors with code, and records taps and typing as a script. It is optional and runs only while the command runs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func At

func At(roots []*spec.Node, x, y int) *spec.Node

At returns the smallest element that contains the point, the one a tap there hits.

func Script

func Script(lang, device string, steps []Step) string

Script wraps steps into a file you can run as is.

Types

type Inspector

type Inspector struct {
	// contains filtered or unexported fields
}

func New

func New(cl *client.Client, loopback bool) *Inspector

func (*Inspector) Handler

func (in *Inspector) Handler() http.Handler

func (*Inspector) Listen

func (in *Inspector) Listen(events <-chan map[string]any)

Listen reads action events from the phones and turns them into steps.

type Selector

type Selector struct {
	By    any    `json:"by"` // a selector name, or a query object
	Value string `json:"value,omitempty"`
	Nth   int    `json:"nth"`
	Count int    `json:"count"`
}

Selector is one way to find an element, with how many elements it matches and which of them is the one wanted.

func Suggest

func Suggest(roots []*spec.Node, target *spec.Node) []Selector

Suggest lists selectors for target, the ones that match only it first. The order within each group prefers what survives app updates: id, then text, then description, then combinations and relations, and a class with nth last.

type Step

type Step struct {
	Cmd      string    `json:"cmd"` // launch, touch, long_touch, input, get_text
	Sel      *Selector `json:"sel,omitempty"`
	Text     string    `json:"text,omitempty"`
	Package  string    `json:"package,omitempty"`
	Password bool      `json:"password,omitempty"`
	// contains filtered or unexported fields
}

Step is one line of a recorded or inspected script.

func (Step) Code

func (s Step) Code(lang string) string

Code renders the step in "python", "node" or "cli".

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL