Documentation
¶
Index ¶
- func Request(data map[string]any, opts ...Option) (map[string]any, error)
- type BrowserRunner
- type Callback
- type ChromeDPAction
- type ChromeDPRunner
- type MockRunner
- func (m *MockRunner) GetAllCalls() [][]chromedp.Action
- func (m *MockRunner) GetCallCount() int
- func (m *MockRunner) GetLastCall() []chromedp.Action
- func (m *MockRunner) Run(ctx context.Context, actions ...chromedp.Action) error
- func (m *MockRunner) SetRunFunc(fn func(ctx context.Context, actions ...chromedp.Action) error)
- func (m *MockRunner) Start(ctx context.Context) error
- type Option
- type Req
- type Res
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BrowserRunner ¶
type BrowserRunner interface {
// Start launches the browser. chromedp ties the browser process to the
// context of the first Run, so the browser is started on a context
// without the actions' deadline and outlives a timed-out action.
Start(ctx context.Context) error
Run(ctx context.Context, actions ...chromedp.Action) error
}
BrowserRunner defines the interface for running browser actions
type ChromeDPAction ¶
type ChromeDPAction struct {
ID string `map:"id"`
Name string `map:"name"`
URL string `map:"url"`
Selector string `map:"selector"`
Attribute []string `map:"attribute"`
Value string `map:"value"`
Path string `map:"path"` // Deprecated: use FilePath from results
Quality int `map:"quality"`
// contains filtered or unexported fields
}
func NewChromeDPAction ¶
func NewChromeDPAction() *ChromeDPAction
type ChromeDPRunner ¶
type ChromeDPRunner struct{}
ChromeDPRunner implements BrowserRunner using the actual ChromeDP
type MockRunner ¶
type MockRunner struct {
RunFunc func(ctx context.Context, actions ...chromedp.Action) error
CallHistory [][]chromedp.Action
// contains filtered or unexported fields
}
MockRunner implements BrowserRunner for testing
func NewMockRunner ¶
func NewMockRunner() *MockRunner
NewMockRunner creates a new mock browser runner
func (*MockRunner) GetAllCalls ¶
func (m *MockRunner) GetAllCalls() [][]chromedp.Action
GetAllCalls returns all recorded Run calls
func (*MockRunner) GetCallCount ¶
func (m *MockRunner) GetCallCount() int
GetCallCount returns the number of Run calls made
func (*MockRunner) GetLastCall ¶
func (m *MockRunner) GetLastCall() []chromedp.Action
GetLastCall returns the actions from the most recent Run call
func (*MockRunner) SetRunFunc ¶
SetRunFunc sets a custom function to execute when Run is called
type Req ¶
type Req struct {
Actions []*ChromeDPAction `map:"actions"`
Headless bool `map:"headless"`
WindowW int `map:"window_w"`
WindowH int `map:"window_h"`
// EvidenceDir is where the page is saved when the actions fail. Empty
// means the system's temporary directory.
EvidenceDir string `map:"evidence_dir"`
Timeout time.Duration
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.