html

package
v0.59.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLocatorMap

func CreateLocatorMap(source string) (map[string][]string, error)

func GetOptimalXPath

func GetOptimalXPath(doc Document, domNode Node) string

func IsValidXPath

func IsValidXPath(xpath, dom string) (bool, error)

func MinifySource

func MinifySource(source string) (*types.ElementSpec, error)

func PrintLocatrs

func PrintLocatrs(locatrs []string)

nolint:unused

func PrintXmlTree

func PrintXmlTree(node *html.Node, depth int)

nolint:unused

Types

type Document

type Document interface {
	Find(xpath string) []Node
}

type HTMLDoc

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

func NewHTMLDoc

func NewHTMLDoc(root *html.Node) *HTMLDoc

func (*HTMLDoc) Find

func (d *HTMLDoc) Find(xpath string) []Node

func (*HTMLDoc) Root

func (d *HTMLDoc) Root() *HTMLNode

type HTMLNode

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

func NewHTMLNode

func NewHTMLNode(node *html.Node) *HTMLNode

func (*HTMLNode) ChildNodes

func (n *HTMLNode) ChildNodes() []Node

func (*HTMLNode) Equal

func (n *HTMLNode) Equal(n1 Node) bool

func (*HTMLNode) GetAttribute

func (n *HTMLNode) GetAttribute(key string) string

func (*HTMLNode) GetParent

func (n *HTMLNode) GetParent() Node

func (*HTMLNode) HasParent

func (n *HTMLNode) HasParent() bool

func (*HTMLNode) Index

func (n *HTMLNode) Index() int

func (HTMLNode) IsElement

func (n HTMLNode) IsElement() bool

func (HTMLNode) TagName

func (n HTMLNode) TagName() string

type Node

type Node interface {
	TagName() string
	IsElement() bool
	HasParent() bool
	GetAttribute(key string) string
	GetParent() Node
	ChildNodes() []Node
	Index() int
	Equal(Node) bool
}

Jump to

Keyboard shortcuts

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