HomeUniDoc
...

Package selector

Overview ▾

Index ▾

Package files

selector_by.go

type ByType

ByType is a 'By' selector type enumerator.

type ByType uint

Enumerated definitions of the ByType selectors.

const (
    ByUndefined ByType = iota
    // ByID is an element query option to select a single element by its CSS #id.
    // Similar to calling document.querySelector('#' + ID) in the browser.
    ByID

    // ByQueryAll is an element query action option to select elements by the
    // DOM.querySelectorAll command.
    //
    // Similar to calling document.querySelectorAll() in the browser.
    ByQueryAll

    // ByQuery is an element query action option to select a single element by the
    // DOM.querySelector command.
    //
    // Similar to calling document.querySelector() in the browser.
    ByQuery

    // ByNodeID is an element query option to select elements by their node IDs.
    //
    // Uses DOM.requestChildNodes to retrieve elements with specific node IDs.
    ByNodeID

    // ByJSPath is an element query option to select elements by the "JS Path"
    // value (as shown in the Chrome DevTools UI).
    //
    // Allows for the direct querying of DOM elements that otherwise cannot be
    // retrieved using the other By* funcs, such as ShadowDOM elements.
    //
    // Note: Do not use with an untrusted selector value, as any defined selector will be passed to runtime.Evaluate.
    ByJSPath

    // BySearch is an element query option to select elements by the DOM.performSearch
    // command. Works with both CSS and XPath queries.
    BySearch
)

func (ByType) Validate

func (b ByType) Validate() error

Validate checks validity of the ByType.