Documentation ¶
Overview ¶
Package view provides various query and UI operation methods on android UI View. It internally uses uiautomator XML dump mechanism to parse device view hierarchy, so all operations are based on information extracted from XML hierarchy dump. TODO : Detailed package documentation need to be done here.
Index ¶
- type DeviceView
- func (devView DeviceView) CheckCheckboxByResource(resource string, index int, timeout int) error
- func (devView DeviceView) ClickDescription(description string, index int, timeout int) error
- func (devView DeviceView) ClickMatchingDescription(description string, index int, timeout int) error
- func (devView DeviceView) ClickMatchingResource(resource string, index int, timeout int) error
- func (devView DeviceView) ClickMatchingResourceAfterText(resource string, text string, index int, timeout int) error
- func (devView DeviceView) ClickMatchingResourceInterruptable(resource string, index int, timeout int, control chan bool) error
- func (devView DeviceView) ClickMatchingText(text string, index int, timeout int) error
- func (devView DeviceView) ClickMatchingType(typename string, index int, timeout int) error
- func (devView DeviceView) ClickResource(resource string, index int, timeout int) error
- func (devView DeviceView) ClickText(text string, index int, timeout int) error
- func (devView DeviceView) ClickType(typename string, index int, timeout int) error
- func (devView DeviceView) ClickTypeForMatchingResource(resource string, index int, timeout int) error
- func (devView DeviceView) ClickTypeForMatchingText(text string, index int, timeout int) error
- func (devView DeviceView) GetDescriptionForMatchingResource(resource string, index int, timeout int) (string, error)
- func (devView DeviceView) GetDescriptionForMatchingText(text string, index int, timeout int) (string, error)
- func (devView DeviceView) GetDescriptionForMatchingType(typename string, index int, timeout int) (string, error)
- func (devView DeviceView) GetDescriptionForResource(resource string, index int, timeout int) (string, error)
- func (devView DeviceView) GetDescriptionForText(text string, index int, timeout int) (string, error)
- func (devView DeviceView) GetDescriptionFortype(typename string, index int, timeout int) (string, error)
- func (devView DeviceView) GetHierarchy() (Hierarchy, error)
- func (devView DeviceView) GetResourceForDescription(description string, index int, timeout int) (string, error)
- func (devView DeviceView) GetResourceForMatchingDescription(description string, index int, timeout int) (string, error)
- func (devView DeviceView) GetResourceForMatchingText(text string, index int, timeout int) (string, error)
- func (devView DeviceView) GetResourceForMatchingTextInterruptable(text string, index int, timeout int, control chan bool) (string, error)
- func (devView DeviceView) GetResourceForMatchingType(typename string, index int, timeout int) (string, error)
- func (devView DeviceView) GetResourceForText(text string, index int, timeout int) (string, error)
- func (devView DeviceView) GetResourceForType(typename string, index int, timeout int) (string, error)
- func (devView DeviceView) GetTextForDescription(description string, index int, timeout int) (string, error)
- func (devView DeviceView) GetTextForMatchingDescription(description string, index int, timeout int) (string, error)
- func (devView DeviceView) GetTextForMatchingResource(resource string, index int, timeout int) (string, error)
- func (devView DeviceView) GetTextForMatchingType(typename string, index int, timeout int) (string, error)
- func (devView DeviceView) GetTextForResource(resource string, index int, timeout int) (string, error)
- func (devView DeviceView) GetTextForType(typename string, index int, timeout int) (string, error)
- func (devView DeviceView) GetTypeForDescription(description string, index int, timeout int) (string, error)
- func (devView DeviceView) GetTypeForMatchingDescription(description string, index int, timeout int) (string, error)
- func (devView DeviceView) GetTypeForMatchingResource(resource string, index int, timeout int) (string, error)
- func (devView DeviceView) GetTypeForMatchingText(text string, index int, timeout int) (string, error)
- func (devView DeviceView) GetTypeForResource(resource string, index int, timeout int) (string, error)
- func (devView DeviceView) GetTypeForText(text string, index int, timeout int) (string, error)
- func (devView DeviceView) GetViewForDescription(description string, index int, timeout int) (View, error)
- func (devView DeviceView) GetViewForMatchingDescription(description string, index int, timeout int) (View, error)
- func (devView DeviceView) GetViewForMatchingResource(resource string, index int, timeout int) (View, error)
- func (devView DeviceView) GetViewForMatchingText(text string, index int, timeout int) (View, error)
- func (devView DeviceView) GetViewForMatchingType(typename string, index int, timeout int) (View, error)
- func (devView DeviceView) GetViewForResource(resource string, index int, timeout int) (View, error)
- func (devView DeviceView) GetViewForText(text string, index int, timeout int) (View, error)
- func (devView DeviceView) GetViewForType(typename string, index int, timeout int) (View, error)
- func (devView DeviceView) GetViewes() (Views, error)
- func (devView DeviceView) IsDescriptionPresent(description string, index int, timeout int) error
- func (devView DeviceView) IsMatchingDescriptionPresnt(description string, index int, timeout int) error
- func (devView DeviceView) IsMatchingResourcePresnt(resource string, index int, timeout int) error
- func (devView DeviceView) IsMatchingTextPresnt(text string, index int, timeout int) error
- func (devView DeviceView) IsMatchingTypePresnt(typename string, index int, timeout int) error
- func (devView DeviceView) IsResourcePresent(resource string, index int, timeout int) error
- func (devView DeviceView) IsTextPresent(text string, index int, timeout int) error
- func (devView DeviceView) IsTypePresent(typename string, index int, timeout int) error
- func (devView DeviceView) ScrollDownToDescription(description string, index int, maxscroll int) error
- func (devView DeviceView) ScrollDownToMatchingDescription(description string, index int, maxscroll int) error
- func (devView DeviceView) ScrollDownToMatchingResource(resource string, index int, maxscroll int) error
- func (devView DeviceView) ScrollDownToMatchingText(text string, index int, maxscroll int) error
- func (devView DeviceView) ScrollDownToMatchingType(typename string, index int, maxscroll int) error
- func (devView DeviceView) ScrollDownToResource(resource string, index int, maxscroll int) error
- func (devView DeviceView) ScrollDownToText(text string, index int, maxscroll int) error
- func (devView DeviceView) ScrollDownToType(typename string, index int, maxscroll int) error
- func (devView DeviceView) ScrollUpToDescription(description string, index int, maxscroll int) error
- func (devView DeviceView) ScrollUpToMatchingDescription(description string, index int, maxscroll int) error
- func (devView DeviceView) ScrollUpToMatchingResource(resource string, index int, maxscroll int) error
- func (devView DeviceView) ScrollUpToMatchingText(text string, index int, maxscroll int) error
- func (devView DeviceView) ScrollUpToMatchingType(typename string, index int, maxscroll int) error
- func (devView DeviceView) ScrollUpToResource(resource string, index int, maxscroll int) error
- func (devView DeviceView) ScrollUpToText(text string, index int, maxscroll int) error
- func (devView DeviceView) ScrollUpToType(typename string, index int, maxscroll int) error
- type Hierarchy
- type Node
- type Nodes
- type View
- type Views
- func (views Views) GetByDescription(description string, index int) (View, bool)
- func (views Views) GetByMatchingDescription(description string, index int) (View, bool)
- func (views Views) GetByMatchingResource(resource string, index int) (View, bool)
- func (views Views) GetByMatchingResourceAfterText(resource string, text string) (View, bool)
- func (views Views) GetByMatchingText(text string, index int) (View, bool)
- func (views Views) GetByMatchingType(typename string, index int) (View, bool)
- func (views Views) GetByResource(resource string, index int) (View, bool)
- func (views Views) GetByText(text string, index int) (View, bool)
- func (views Views) GetByType(typename string, index int) (View, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeviceView ¶
type DeviceView struct {
// contains filtered or unexported fields
}
func NewDeviceView ¶
func NewDeviceView(dev device.Device) DeviceView
func (DeviceView) CheckCheckboxByResource ¶
func (devView DeviceView) CheckCheckboxByResource(resource string, index int, timeout int) error
func (DeviceView) ClickDescription ¶
func (devView DeviceView) ClickDescription(description string, index int, timeout int) error
func (DeviceView) ClickMatchingDescription ¶
func (devView DeviceView) ClickMatchingDescription(description string, index int, timeout int) error
func (DeviceView) ClickMatchingResource ¶
func (devView DeviceView) ClickMatchingResource(resource string, index int, timeout int) error
func (DeviceView) ClickMatchingResourceAfterText ¶
func (devView DeviceView) ClickMatchingResourceAfterText(resource string, text string, index int, timeout int) error
TODO reduce code duplication
func (DeviceView) ClickMatchingResourceInterruptable ¶
func (DeviceView) ClickMatchingText ¶
func (devView DeviceView) ClickMatchingText(text string, index int, timeout int) error
func (DeviceView) ClickMatchingType ¶
func (devView DeviceView) ClickMatchingType(typename string, index int, timeout int) error
func (DeviceView) ClickResource ¶
func (devView DeviceView) ClickResource(resource string, index int, timeout int) error
func (DeviceView) ClickText ¶
func (devView DeviceView) ClickText(text string, index int, timeout int) error
func (DeviceView) ClickType ¶
func (devView DeviceView) ClickType(typename string, index int, timeout int) error
func (DeviceView) ClickTypeForMatchingResource ¶
func (devView DeviceView) ClickTypeForMatchingResource(resource string, index int, timeout int) error
func (DeviceView) ClickTypeForMatchingText ¶
func (devView DeviceView) ClickTypeForMatchingText(text string, index int, timeout int) error
func (DeviceView) GetDescriptionForMatchingResource ¶
func (DeviceView) GetDescriptionForMatchingText ¶
func (DeviceView) GetDescriptionForMatchingType ¶
func (DeviceView) GetDescriptionForResource ¶
func (DeviceView) GetDescriptionForText ¶
func (DeviceView) GetDescriptionFortype ¶
func (DeviceView) GetHierarchy ¶
func (devView DeviceView) GetHierarchy() (Hierarchy, error)
func (DeviceView) GetResourceForDescription ¶
func (DeviceView) GetResourceForMatchingDescription ¶
func (DeviceView) GetResourceForMatchingText ¶
func (DeviceView) GetResourceForMatchingTextInterruptable ¶
func (DeviceView) GetResourceForMatchingType ¶
func (DeviceView) GetResourceForText ¶
func (DeviceView) GetResourceForType ¶
func (DeviceView) GetTextForDescription ¶
func (DeviceView) GetTextForMatchingDescription ¶
func (DeviceView) GetTextForMatchingResource ¶
func (DeviceView) GetTextForMatchingType ¶
func (DeviceView) GetTextForResource ¶
func (DeviceView) GetTextForType ¶
func (DeviceView) GetTypeForDescription ¶
func (DeviceView) GetTypeForMatchingDescription ¶
func (DeviceView) GetTypeForMatchingResource ¶
func (DeviceView) GetTypeForMatchingText ¶
func (DeviceView) GetTypeForResource ¶
func (DeviceView) GetTypeForText ¶
func (DeviceView) GetViewForDescription ¶
func (DeviceView) GetViewForMatchingDescription ¶
func (DeviceView) GetViewForMatchingResource ¶
func (DeviceView) GetViewForMatchingText ¶
func (DeviceView) GetViewForMatchingType ¶
func (DeviceView) GetViewForResource ¶
func (DeviceView) GetViewForText ¶
func (DeviceView) GetViewForType ¶
func (DeviceView) GetViewes ¶
func (devView DeviceView) GetViewes() (Views, error)
func (DeviceView) IsDescriptionPresent ¶
func (devView DeviceView) IsDescriptionPresent(description string, index int, timeout int) error
func (DeviceView) IsMatchingDescriptionPresnt ¶
func (devView DeviceView) IsMatchingDescriptionPresnt(description string, index int, timeout int) error
func (DeviceView) IsMatchingResourcePresnt ¶
func (devView DeviceView) IsMatchingResourcePresnt(resource string, index int, timeout int) error
func (DeviceView) IsMatchingTextPresnt ¶
func (devView DeviceView) IsMatchingTextPresnt(text string, index int, timeout int) error
func (DeviceView) IsMatchingTypePresnt ¶
func (devView DeviceView) IsMatchingTypePresnt(typename string, index int, timeout int) error
func (DeviceView) IsResourcePresent ¶
func (devView DeviceView) IsResourcePresent(resource string, index int, timeout int) error
func (DeviceView) IsTextPresent ¶
func (devView DeviceView) IsTextPresent(text string, index int, timeout int) error
func (DeviceView) IsTypePresent ¶
func (devView DeviceView) IsTypePresent(typename string, index int, timeout int) error
func (DeviceView) ScrollDownToDescription ¶
func (devView DeviceView) ScrollDownToDescription(description string, index int, maxscroll int) error
func (DeviceView) ScrollDownToMatchingDescription ¶
func (devView DeviceView) ScrollDownToMatchingDescription(description string, index int, maxscroll int) error
func (DeviceView) ScrollDownToMatchingResource ¶
func (devView DeviceView) ScrollDownToMatchingResource(resource string, index int, maxscroll int) error
func (DeviceView) ScrollDownToMatchingText ¶
func (devView DeviceView) ScrollDownToMatchingText(text string, index int, maxscroll int) error
func (DeviceView) ScrollDownToMatchingType ¶
func (devView DeviceView) ScrollDownToMatchingType(typename string, index int, maxscroll int) error
func (DeviceView) ScrollDownToResource ¶
func (devView DeviceView) ScrollDownToResource(resource string, index int, maxscroll int) error
func (DeviceView) ScrollDownToText ¶
func (devView DeviceView) ScrollDownToText(text string, index int, maxscroll int) error
func (DeviceView) ScrollDownToType ¶
func (devView DeviceView) ScrollDownToType(typename string, index int, maxscroll int) error
func (DeviceView) ScrollUpToDescription ¶
func (devView DeviceView) ScrollUpToDescription(description string, index int, maxscroll int) error
func (DeviceView) ScrollUpToMatchingDescription ¶
func (devView DeviceView) ScrollUpToMatchingDescription(description string, index int, maxscroll int) error
func (DeviceView) ScrollUpToMatchingResource ¶
func (devView DeviceView) ScrollUpToMatchingResource(resource string, index int, maxscroll int) error
func (DeviceView) ScrollUpToMatchingText ¶
func (devView DeviceView) ScrollUpToMatchingText(text string, index int, maxscroll int) error
func (DeviceView) ScrollUpToMatchingType ¶
func (devView DeviceView) ScrollUpToMatchingType(typename string, index int, maxscroll int) error
func (DeviceView) ScrollUpToResource ¶
func (devView DeviceView) ScrollUpToResource(resource string, index int, maxscroll int) error
func (DeviceView) ScrollUpToText ¶
func (devView DeviceView) ScrollUpToText(text string, index int, maxscroll int) error
func (DeviceView) ScrollUpToType ¶
func (devView DeviceView) ScrollUpToType(typename string, index int, maxscroll int) error
type Hierarchy ¶
type Hierarchy struct { XMLName xml.Name `xml:"hierarchy"` // Namespace of the hierarchy Rotation string `xml:"rotation,attr"` // Rotation value of the hierarchy NodeList Nodes `xml:"node"` // Child nodes in the hierarchy }
func (Hierarchy) ConvertToViews ¶
type Node ¶
type Node struct { XMLName xml.Name `xml:"node"` // Namespace of the node Index string `xml:"index,attr"` // Index of the node Resource string `xml:"resource-id,attr"` // Index of the node Class string `xml:"class,attr"` // Class of the node Package string `xml:"package,attr"` // Package of the node Text string `xml:"text,attr"` // Text of the node Description string `xml:"content-desc,attr"` // Description of the node Checkable string `xml:"checkable,attr"` // Checkable status of the node Checked string `xml:"checked,attr"` // Checked status of the node Clickable string `xml:"clickable,attr"` // Clickble status of the node Enabled string `xml:"enabled,attr"` // Enabled status of the node Focusable string `xml:"focusable,attr"` // Focusable status of the node Focused string `xml:"focused,attr"` // Focused status of the node Scrollable string `xml:"scrollable,attr"` // Scrollable status of the node LongClickable string `xml:"long-clickable,attr"` // Long clickable status of the node Password string `xml:"password,attr"` // Password field status of the node Selected string `xml:"selected,attr"` // Selection status of the node Bounds string `xml:"bounds,attr"` // View bounds of the node ChildNodes Nodes `xml:"node"` // Child nodes for this node }
type View ¶
type View struct { TreeIndex int //Index value on the tree representation of the hierarchy. TreeParentIndex int //Index value of the parent node in the tree representation of the hierarchy. Index int // Index value of the android view component. Class string // Canonical class name of the android view component. Package string // Canonical package name of the android view component. Resource string // Associated resource id (if any) of the view component. Text string // Associated text (if any) of the view component. Description string // Associated description (if any) of the view component. Clickable bool // Boolean value indicating if the view is clickable. Checkable bool // Boolean value indicating if the view is checkbox or not. Checked bool // Boolean value indicating if the view is checked or not. Enabled bool // Boolean value indicating if the view is enabled or not. Focusable bool // Boolean value indicating if the view is focusable by user or not. Focused bool // Boolean value indicating if the view is currently focused or not. Scrollable bool // Boolean value indicating if the view is scrollable or not. LongClickable bool // Boolean value indicating if the view is long click enabled or not. Password bool // Boolean value indicating if the view is a password field or not. Selected bool // Boolean value indicating if the view is currently selected by user or not. Bound geometry.Rect // Bounding rectangle of the view. Center geometry.Point // Center coordinate of the view. }
View struct is an internal representation of android ui component. This is generated from uiautomaror XML dump but in a representation that is more suitable for various UI operations by goandroid framework. It is a typed representation of uiautomator node. Some extra fields are calculated for ease of use, such as center of the view, which allows to click the view and index of the view. Index is calculated based on occurence of the node in uiautomator xml dump.
type Views ¶
type Views []View
Views is a type that represents sclice of View structure.
func (Views) GetByDescription ¶
GetByDescription method returns a View struct based on excat match of specified text value of views description and index. It also returns a boolean value indicating if the match is found or not. Please note that parameter index is zero based index system, that is, index value of first element is zero. If no view is found with exact description text match, empty view is returned with boolean value false indicating view is not found.
func (Views) GetByMatchingDescription ¶
GetByMatchingDescription method returns a View struct on matching text value of description field of the view with specified index. It also returns a boolean value indicating if the match is found or not. Please note that parameter index is zero based index system, that is, index value of first element is zero. If no view is found with matching description value, empty view is returned with boolean value false indicating view is not found. Description match is case insensitive.
func (Views) GetByMatchingResource ¶
GetByMatchingResource method returns a View struct on matching text value of resource id with specified index. It also returns a boolean value indicating if the match is found or not. Please note that parameter index is zero based index system, that is, index value of first element is zero. If no view is found with matching test value of resource id, empty view is returned with boolean value false indicating view is not found. Resource id match is case insensitive. NOTE : Here resource id represents following "<resource_id>" part only
<package_name>:id/<resource_id>
func (Views) GetByMatchingResourceAfterText ¶
func (Views) GetByMatchingText ¶
GetByMatchingText method returns a View struct on matching text with specified index. It also returns a boolean value indicating if the match is found or not. Please note that parameter index is zero based index system, that is, index value of first element is zero. If no view is found with matching text, empty view is returned with boolean value false indicating view is not found. Text match is case insensitive.
func (Views) GetByMatchingType ¶
GetByMatchingType method returns a View struct on matching text value of class name field of the view with specified index. It also returns a boolean value indicating if the match is found or not. Please note that parameter index is zero based index system, that is, index value of first element is zero. If no view is found with matching class name, empty view is returned with boolean value false indicating view is not found. Class name match is case insensitive.
func (Views) GetByResource ¶
GetByResource method returns a View struct based on excat match of specified text value of view resource id and index. It also returns a boolean value indicating if the match is found or not. Please note that parameter index is zero based index system, that is, index value of first element is zero. If no view is found with exact resource id match, empty view is returned with boolean value false indicating view is not found. NOTE : Here resource id represents following "<resource_id>" part only
<package_name>:id/<resource_id>
func (Views) GetByText ¶
GetByText method returns a View struct based on excat match of specified text and index. It also returns a boolean value indicating if the match is found or not. Please note that parameter index is zero based index system, that is, index value of first element is zero. If no view is found with exact text match, empty view is returned with boolean value false indicating view is not found.
func (Views) GetByType ¶
GetByType method returns a View struct based on excat match of specified text value of views class name and index. It also returns a boolean value indicating if the match is found or not. Please note that parameter index is zero based index system, that is, index value of first element is zero. If no view is found with exact class name match, empty view is returned with boolean value false indicating view is not found.