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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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