headless

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Engine       *gin.Engine
	LauncherPath string
)

Functions

func Init

func Init(launcherPath string)

Types

type FindRequest

type FindRequest struct {
	Location string `json:"location"`
	Timeout  string `json:"timeout"`
	Match    Match  `json:"match"`
}

type FindRespond

type FindRespond struct {
	Content string `json:"content"`
	Message string `json:"message,omitempty"`
}

type HeadlessClient

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

HeadlessClient handles communication for headless browser service

func NewHeadlessClient

func NewHeadlessClient(url string) *HeadlessClient

NewHeadlessClient creates a new headless client

func (*HeadlessClient) Find

func (h *HeadlessClient) Find(ctx context.Context, payload *FindRequest) (string, error)

Find find whether the target matching payload exists

type Match

type Match struct {
	Type        string       `json:"type"`
	MatchRegExp *MatchRegExp `json:"regexp"`
	MatchXPath  *MatchXPath  `json:"xpath"`
	MatchJS     *MatchJS     `json:"js"`
}

type MatchJS

type MatchJS struct {
	// Value is the javascript value
	Value string `json:"value"`
}

type MatchRegExp

type MatchRegExp struct {
	// Selector is the target element if not specified "*" will be used
	Selector string `json:"selector"`

	// Value is the target value
	Value string `json:"value"`
}

type MatchXPath

type MatchXPath struct {
	// Selector is the xpath selector
	Selector string `json:"selector"`
}

Jump to

Keyboard shortcuts

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