nodewith

package
Version: v0.0.0-...-683b059 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package nodewith is used to generate queries to find chrome.automation nodes.

Index

Constants

View Source
const (
	ErrNotFound   = "failed to find node with properties"
	ErrTooGeneric = "multiple nodes matched, if you expect this and only want the first use First()"
)

These are possible errors return by query for a node in JS. They are strings because JS does not return nice Go errors. Instead, it is simplest to just use strings.Contains with these errors.

Variables

This section is empty.

Functions

This section is empty.

Types

type Finder

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

Finder is a mapping of chrome.automation.FindParams to Golang with a nicer API. As defined in chromium/src/extensions/common/api/automation.idl

func Ancestor

func Ancestor(a *Finder) *Finder

Ancestor creates a Finder with the specified ancestor.

func Attribute

func Attribute(k string, v interface{}) *Finder

Attribute creates a Finder with the specified attribute.

func AutofillAvailable

func AutofillAvailable() *Finder

AutofillAvailable creates a Finder with AutofillAvailable set to true.

func ClassName

func ClassName(n string) *Finder

ClassName creates a Finder with the specified class name. Deprecated: Use HasClass.

func Collapsed

func Collapsed() *Finder

Collapsed creates a Finder with Collapsed set to true.

func Default

func Default() *Finder

Default creates a Finder with Default set to true.

func Editable

func Editable() *Finder

Editable creates a Finder with Editable set to true.

func Expanded

func Expanded() *Finder

Expanded creates a Finder with Expanded set to true.

func First

func First() *Finder

First creates a Finder that will find the first node instead of requiring uniqueness.

func Focusable

func Focusable() *Finder

Focusable creates a Finder with Focusable set to true.

func Focused

func Focused() *Finder

Focused creates a Finder with Focused set to true.

func HasClass

func HasClass(c string) *Finder

HasClass creates a Finder with a class name containing the specified class name.

func Horizontal

func Horizontal() *Finder

Horizontal creates a Finder with Horizontal set to true.

func Hovered

func Hovered() *Finder

Hovered creates a Finder with Hovered set to true.

func Ignored

func Ignored() *Finder

Ignored creates a Finder with Ignored set to true.

func Invisible

func Invisible() *Finder

Invisible creates a Finder with Invisible set to true.

func Linked

func Linked() *Finder

Linked creates a Finder with Linked set to true.

func Multiline

func Multiline() *Finder

Multiline creates a Finder with Multiline set to true.

func MultilingualName

func MultilingualName(english string, other map[string]string) *Finder

MultilingualName creates a Finder with the specified names.

func MultilingualNameContaining

func MultilingualNameContaining(english string, other map[string]string) *Finder

MultilingualNameContaining creates a Finder with a name containing the specified strings.

func MultilingualNameRegex

func MultilingualNameRegex(english *regexp.Regexp, other map[string]regexp.Regexp) *Finder

MultilingualNameRegex creates a Finder with a name containing the specified regexp.

func MultilingualNameStartingWith

func MultilingualNameStartingWith(english string, other map[string]string) *Finder

MultilingualNameStartingWith creates a Finder with a name starting with the specified strings.

func Multiselectable

func Multiselectable() *Finder

Multiselectable creates a Finder with Multiselectable set to true.

func Name

func Name(n string) *Finder

Name creates a Finder with the specified name.

func NameContaining

func NameContaining(n string) *Finder

NameContaining creates a Finder with a name containing the specified string.

func NameRegex

func NameRegex(r *regexp.Regexp) *Finder

NameRegex creates a Finder with a name containing the specified regexp.

func NameStartingWith

func NameStartingWith(n string) *Finder

NameStartingWith creates a Finder with a name starting with the specified string.

func Nth

func Nth(n int) *Finder

Nth creates a Finder that will find the n-th node in the matched nodes of the Finder, instead of requiring uniqueness.

func Offscreen

func Offscreen() *Finder

Offscreen creates a Finder with Offscreen set to true.

func Onscreen

func Onscreen() *Finder

Onscreen creates a Finder with Offscreen set to false.

func Protected

func Protected() *Finder

Protected creates a Finder with Protected set to true.

func Required

func Required() *Finder

Required creates a Finder with Required set to true.

func RichlyEditable

func RichlyEditable() *Finder

RichlyEditable creates a Finder with RichlyEditable set to true.

func Role

func Role(r role.Role) *Finder

Role creates a Finder with the specified role.

func Root

func Root() *Finder

Root creates a Finder that will find the root node.

func State

func State(k state.State, v bool) *Finder

State creates a Finder with the specified state.

func Vertical

func Vertical() *Finder

Vertical creates a Finder with Vertical set to true.

func Visible

func Visible() *Finder

Visible creates a Finder with Invisible set to false.

func Visited

func Visited() *Finder

Visited creates a Finder with Visited set to true.

func (*Finder) Ancestor

func (f *Finder) Ancestor(a *Finder) *Finder

Ancestor creates a copy of the input Finder with the specified ancestor.

func (*Finder) Attribute

func (f *Finder) Attribute(k string, v interface{}) *Finder

Attribute creates a copy of the input Finder with the specified attribute.

func (*Finder) AutofillAvailable

func (f *Finder) AutofillAvailable() *Finder

AutofillAvailable creates a copy of the input Finder with AutofillAvailable set to true.

func (*Finder) ClassName

func (f *Finder) ClassName(n string) *Finder

ClassName creates a copy of the input Finder with the specified class name. Deprecated: Use HasClass.

func (*Finder) Collapsed

func (f *Finder) Collapsed() *Finder

Collapsed creates a copy of the input Finder with Collapsed set to true.

func (*Finder) Default

func (f *Finder) Default() *Finder

Default creates a copy of the input Finder with Default set to true.

func (*Finder) Editable

func (f *Finder) Editable() *Finder

Editable creates a copy of the input Finder with Editable set to true.

func (*Finder) Expanded

func (f *Finder) Expanded() *Finder

Expanded creates a copy of the input Finder with Expanded set to true.

func (*Finder) FinalAncestor

func (f *Finder) FinalAncestor(a *Finder) *Finder

FinalAncestor creates a copy of the chain of Finders such that the final ancestor is set to a. This can be used to scope an entire query to be a subset of different query.

func (*Finder) First

func (f *Finder) First() *Finder

First creates a copy of the input Finder that will find the first node instead of requiring uniqueness.

func (*Finder) Focusable

func (f *Finder) Focusable() *Finder

Focusable creates a copy of the input Finder with Focusable set to true.

func (*Finder) Focused

func (f *Finder) Focused() *Finder

Focused creates a copy of the input Finder with Focused set to true.

func (*Finder) GenerateQuery

func (f *Finder) GenerateQuery() (string, error)

GenerateQuery generates the JS query to find this node. It must be called in an async function because it starts by awaiting the chrome.automation Desktop node. The final node will be in the variable node.

func (*Finder) GenerateQueryForMultipleNodes

func (f *Finder) GenerateQueryForMultipleNodes() (string, error)

GenerateQueryForMultipleNodes generates the JS query to find one or more nodes. It must be called in an async function because it starts by awaiting the chrome.automation Desktop node.

func (*Finder) HasClass

func (f *Finder) HasClass(c string) *Finder

HasClass creates a copy of the input Finder with a class name containing the specified class name.

func (*Finder) Horizontal

func (f *Finder) Horizontal() *Finder

Horizontal creates a copy of the input Finder with Horizontal set to true.

func (*Finder) Hovered

func (f *Finder) Hovered() *Finder

Hovered creates a copy of the input Finder with Hovered set to true.

func (*Finder) Ignored

func (f *Finder) Ignored() *Finder

Ignored creates a copy of the input Finder with Ignored set to true.

func (*Finder) Invisible

func (f *Finder) Invisible() *Finder

Invisible creates a copy of the input Finder with Invisible set to true.

func (*Finder) Linked

func (f *Finder) Linked() *Finder

Linked creates a copy of the input Finder with Linked set to true.

func (*Finder) Multiline

func (f *Finder) Multiline() *Finder

Multiline creates a copy of the input Finder with Multiline set to true.

func (*Finder) MultilingualName

func (f *Finder) MultilingualName(english string, other map[string]string) *Finder

MultilingualName creates a copy of the input Finder with the specified names.

func (*Finder) MultilingualNameContaining

func (f *Finder) MultilingualNameContaining(english string, other map[string]string) *Finder

MultilingualNameContaining creates a copy of the input Finder with a name containing the specified strings.

func (*Finder) MultilingualNameRegex

func (f *Finder) MultilingualNameRegex(english *regexp.Regexp, other map[string]regexp.Regexp) *Finder

MultilingualNameRegex creates a copy of the input Finder with a name containing the specified regexp.

func (*Finder) MultilingualNameStartingWith

func (f *Finder) MultilingualNameStartingWith(english string, other map[string]string) *Finder

MultilingualNameStartingWith creates a copy of the input Finder with a name starting with the specified strings.

func (*Finder) Multiselectable

func (f *Finder) Multiselectable() *Finder

Multiselectable creates a copy of the input Finder with Multiselectable set to true.

func (*Finder) Name

func (f *Finder) Name(n string) *Finder

Name creates a copy of the input Finder with the specified name.

func (*Finder) NameContaining

func (f *Finder) NameContaining(n string) *Finder

NameContaining creates a copy of the input Finder with a name containing the specified string.

func (*Finder) NameRegex

func (f *Finder) NameRegex(r *regexp.Regexp) *Finder

NameRegex creates a copy of the input Finder with a name containing the specified regexp.

func (*Finder) NameStartingWith

func (f *Finder) NameStartingWith(n string) *Finder

NameStartingWith creates a copy of the input Finder with a name starting with the specified string.

func (*Finder) Nth

func (f *Finder) Nth(n int) *Finder

Nth creates a copy of the input Finder that will find the n-th node in the matched nodes of the Finder, instead of requiring uniqueness.

func (*Finder) Offscreen

func (f *Finder) Offscreen() *Finder

Offscreen creates a copy of the input Finder with Offscreen set to true.

func (*Finder) Onscreen

func (f *Finder) Onscreen() *Finder

Onscreen creates a copy of the input Finder with Offscreen set to false.

func (*Finder) Pretty

func (f *Finder) Pretty() string

Pretty returns a nice-looking human-readable version of the finder. For example, Pretty(Name("hello").ClassName("cls").Ancestor(Role(role.Button))) will return `{name: /^hello$/, className: "cls", ancestor: {role: button}}`.

func (*Finder) Protected

func (f *Finder) Protected() *Finder

Protected creates a copy of the input Finder with Protected set to true.

func (*Finder) Required

func (f *Finder) Required() *Finder

Required creates a copy of the input Finder with Required set to true.

func (*Finder) RichlyEditable

func (f *Finder) RichlyEditable() *Finder

RichlyEditable creates a copy of the input Finder with RichlyEditable set to true.

func (*Finder) Role

func (f *Finder) Role(r role.Role) *Finder

Role creates a copy of the input Finder with the specified role.

func (*Finder) State

func (f *Finder) State(k state.State, v bool) *Finder

State creates a copy of the input Finder with the specified state.

func (*Finder) Vertical

func (f *Finder) Vertical() *Finder

Vertical creates a copy of the input Finder with Vertical set to true.

func (*Finder) Visible

func (f *Finder) Visible() *Finder

Visible creates a copy of the input Finder with Invisible set to false.

func (*Finder) Visited

func (f *Finder) Visited() *Finder

Visited creates a copy of the input Finder with Visited set to true.

Source Files

Jump to

Keyboard shortcuts

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