Documentation
¶
Index ¶
- Constants
- Variables
- func CheckPrivateURL(ctx context.Context, rawURL string) error
- func CheckURL(ctx context.Context, rawURL string) error
- func DiscoverLiveWS(ctx context.Context) (string, error)
- func DiscoverWSForProfile(ctx context.Context, base string) (ws string, ok bool)
- func SetDriver(d string)
- type Backend
- type Browser
- func (b *Browser) AXTree(ctx context.Context) (string, error)
- func (b *Browser) Back(ctx context.Context) error
- func (b *Browser) BoxModel(ctx context.Context, backendNodeID int) (float64, float64, error)
- func (b *Browser) ClickAt(ctx context.Context, x, y float64) error
- func (b *Browser) Close() error
- func (b *Browser) Eval(ctx context.Context, expression string) (string, error)
- func (b *Browser) Fill(ctx context.Context, selector, text string) error
- func (b *Browser) HandleDialog(accept bool, promptText string) error
- func (b *Browser) Info(ctx context.Context) (PageInfo, error)
- func (b *Browser) Mode() Mode
- func (b *Browser) Navigate(ctx context.Context, url string) error
- func (b *Browser) Obtained() Obtained
- func (b *Browser) PressKey(ctx context.Context, key string) error
- func (b *Browser) Screenshot(ctx context.Context, maxDim int) ([]byte, error)
- func (b *Browser) Scroll(ctx context.Context, dy float64) error
- func (b *Browser) Tabs(ctx context.Context) ([]Tab, error)
- func (b *Browser) TypeText(ctx context.Context, text string) error
- func (b *Browser) UploadFiles(ctx context.Context, selector string, paths []string) error
- func (b *Browser) UseTab(ctx context.Context, targetID string) error
- func (b *Browser) WaitElement(ctx context.Context, selector string, visible bool) (bool, error)
- func (b *Browser) WaitLoad(ctx context.Context) error
- type Dialog
- type Manager
- type Mode
- type Obtained
- type PageInfo
- type Session
- type Tab
Constants ¶
View Source
const ( DriverRod = "rod" DriverChromedp = "chromedp" )
Variables ¶
View Source
var AllowPrivateURLs = false
View Source
var Driver = func() string { if d := os.Getenv("K_BRAIN_BROWSER_DRIVER"); d != "" { return d } return "rod" }()
View Source
var Drivers = []string{DriverRod, DriverChromedp}
View Source
var ErrNoLiveBrowser = errors.New("no live browser with remote debugging found")
View Source
var ErrPermissionBlocked = errors.New("chrome permission-blocked")
Functions ¶
func CheckPrivateURL ¶
CheckPrivateURL blocks private and internal addresses unless AllowPrivateURLs is set, resolving host names like CheckURL.
func CheckURL ¶
CheckURL blocks cloud-metadata endpoints, resolving host names to catch ones that point at them; a name that does not resolve is blocked.
func DiscoverLiveWS ¶
DiscoverLiveWS returns the first live-browser websocket candidate.
func DiscoverWSForProfile ¶
Types ¶
type Backend ¶
type Backend interface {
Info(ctx context.Context) (PageInfo, error)
Back(ctx context.Context) error
Eval(ctx context.Context, expression string) (string, error)
ClickAt(ctx context.Context, x, y float64) error
TypeText(ctx context.Context, text string) error
PressKey(ctx context.Context, key string) error
Fill(ctx context.Context, selector, text string) error
Scroll(ctx context.Context, dy float64) error
WaitLoad(ctx context.Context) error
WaitElement(ctx context.Context, selector string, visible bool) (bool, error)
Screenshot(ctx context.Context, maxDim int) (jpeg []byte, err error)
AXTree(ctx context.Context) (string, error)
BoxModel(ctx context.Context, backendNodeID int) (x, y float64, err error)
Tabs(ctx context.Context) ([]Tab, error)
UseTab(ctx context.Context, targetID string) error
UploadFiles(ctx context.Context, selector string, paths []string) error
Close() error
Mode() Mode
Obtained() Obtained
HandleDialog(accept bool, promptText string) error
}
type Browser ¶
type Browser struct {
// contains filtered or unexported fields
}
func (*Browser) Screenshot ¶
func (*Browser) UploadFiles ¶
func (*Browser) WaitElement ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) SwitchDriver ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.