Documentation
¶
Index ¶
- Constants
- Variables
- func AsFileLikeMeta(L *lua.LState, r io.Reader) *lua.LTable
- func AsyncRun[T any](env *Environment, L *lua.LState, f func() (T, error)) T
- func HandleError(L *lua.LState, err error)
- func LValueToString(v lua.LValue) string
- func NewContext(arg Arg, debuglog *ayd.Logger) (context.Context, context.CancelFunc)
- func NewElementsTable(L *lua.LState, t *Tab, query string) *lua.LTable
- func NewElementsTableByXPath(L *lua.LState, t *Tab, query string) *lua.LTable
- func NewExecAllocator(ctx context.Context, withHead bool) (context.Context, context.CancelFunc)
- func PackFetchHeader(L *lua.LState, h http.Header) lua.LValue
- func PackFetchResponse(env *Environment, L *lua.LState, resp *http.Response, body io.Reader) lua.LValue
- func PackLValue(L *lua.LState, value any) lua.LValue
- func RegisterAssert(L *lua.LState)
- func RegisterElementType(ctx context.Context, L *lua.LState)
- func RegisterEncodings(env *Environment)
- func RegisterFetch(ctx context.Context, env *Environment)
- func RegisterFileLike(L *lua.LState)
- func RegisterKey(L *lua.LState)
- func RegisterLogger(L *lua.LState, logger *Logger)
- func RegisterTabType(ctx context.Context, env *Environment)
- func RegisterTime(ctx context.Context, env *Environment)
- func Run(arg Arg) ayd.Record
- func URLToTable(L *lua.LState, u *ayd.URL) *lua.LTable
- func UnpackFetchHeader(L *lua.LState, lv lua.LValue) (http.Header, error)
- func UnpackLValue(v lua.LValue) any
- type Arg
- type CookieJar
- type DelayedReader
- type Element
- func (e Element) Blur(L *lua.LState)
- func (e Element) Click(L *lua.LState)
- func (e Element) Focus(L *lua.LState)
- func (e Element) GetAttribute(L *lua.LState) int
- func (e Element) GetInnerHTML(L *lua.LState) int
- func (e Element) GetOuterHTML(L *lua.LState) int
- func (e Element) GetText(L *lua.LState) int
- func (e Element) GetValue(L *lua.LState) int
- func (e Element) Screenshot(L *lua.LState)
- func (e Element) Select(L *lua.LState, query string) Element
- func (e Element) SelectAll(L *lua.LState, query string) *lua.LTable
- func (e Element) SendKeys(L *lua.LState)
- func (e Element) SetValue(L *lua.LState)
- func (e Element) Submit(L *lua.LState)
- func (e Element) ToLua(L *lua.LState) *lua.LUserData
- type Encodings
- type Environment
- func (env *Environment) BuildTable(build func(L *lua.LState, tbl *lua.LTable)) *lua.LTable
- func (env *Environment) CallEventHandler(f *lua.LFunction, arg *lua.LTable, nret int) []lua.LValue
- func (env *Environment) Close() error
- func (env *Environment) DoFile(path string) error
- func (env *Environment) DoREPL(ctx context.Context) error
- func (env *Environment) DoStream(r io.Reader, name string) error
- func (env *Environment) NewFunction(f lua.LGFunction) *lua.LFunction
- func (env *Environment) RecordOnAllTabs(L *lua.LState, taskName string)
- func (env *Environment) RegisterFunction(name string, f lua.LGFunction)
- func (env *Environment) RegisterNewType(name string, methods map[string]lua.LGFunction, fields map[string]lua.LValue)
- func (env *Environment) RegisterTable(name string, fields, meta map[string]lua.LValue)
- func (env *Environment) StartTask(where, taskName string)
- func (env *Environment) Yield()
- type EventHandleFunc
- type EventHandler
- func (h *EventHandler) Close() error
- func (h *EventHandler) Invoke(tab *Tab, event *lua.LTable)
- func (h *EventHandler) IsFuncSet() bool
- func (h *EventHandler) SetFunc(f *lua.LFunction)
- func (h *EventHandler) Status(L *lua.LState) *lua.LTable
- func (h *EventHandler) Wait(ctx context.Context) *lua.LTable
- type LoadWaiter
- type Logger
- func (l *Logger) AsRecord(timestamp time.Time, latency time.Duration) ayd.Record
- func (l *Logger) HandleError(ctx context.Context, err error)
- func (l *Logger) Print(values ...lua.LValue)
- func (l *Logger) SetExtra(k string, v any)
- func (l *Logger) SetLatency(milliseconds float64)
- func (l *Logger) SetStatus(status string)
- func (l *Logger) StartTask(where, name string)
- func (l *Logger) UnsetLatency()
- type RecordAction
- type Recorder
- type SourceImager
- type SourceRecordReader
- type Storage
- func (s *Storage) Artifacts() []string
- func (s *Storage) CancelDownload(guid string)
- func (s *Storage) CompleteDownload(guid string) string
- func (s *Storage) Open(name string) (*os.File, error)
- func (s *Storage) Register(env *Environment)
- func (s *Storage) Remove(path string) error
- func (s *Storage) Save(name, ext string, data []byte) error
- func (s *Storage) StartDownload(guid, name string)
- type Tab
- func (t *Tab) Back(L *lua.LState)
- func (t *Tab) Close() error
- func (t *Tab) Eval(L *lua.LState) int
- func (t *Tab) Forward(L *lua.LState)
- func (t *Tab) GetDialogs(L *lua.LState) int
- func (t *Tab) GetDownload(L *lua.LState) int
- func (t *Tab) GetRequest(L *lua.LState) int
- func (t *Tab) GetResponse(L *lua.LState) int
- func (t *Tab) GetTitle(L *lua.LState) int
- func (t *Tab) GetURL(L *lua.LState) int
- func (t *Tab) GetViewport(L *lua.LState) int
- func (t *Tab) Go(L *lua.LState)
- func (t *Tab) HandleDialog(f *lua.LFunction, ev *lua.LTable)
- func (t *Tab) HandleEvent(f *lua.LFunction, ev *lua.LTable)
- func (t *Tab) LClose(L *lua.LState)
- func (t *Tab) OnDialog(L *lua.LState)
- func (t *Tab) OnDownload(L *lua.LState)
- func (t *Tab) OnRequest(L *lua.LState)
- func (t *Tab) OnResponse(L *lua.LState)
- func (t *Tab) RecordOnce(L *lua.LState, taskName string)
- func (t *Tab) Reload(L *lua.LState)
- func (t *Tab) Run(L *lua.LState, taskName string, capture bool, timeout time.Duration, ...)
- func (t *Tab) RunInCallback(actions ...chromedp.Action) error
- func (t *Tab) RunSelector(L *lua.LState, taskName string, action ...chromedp.Action)
- func (t *Tab) Save(name, ext string, data []byte) error
- func (t *Tab) Screenshot(L *lua.LState)
- func (t *Tab) ToLua(L *lua.LState) *lua.LUserData
- func (t *Tab) Wait(L *lua.LState)
- func (t *Tab) WaitDialog(L *lua.LState) int
- func (t *Tab) WaitDownload(L *lua.LState) int
- func (t *Tab) WaitEvent(L *lua.LState, taskName string, h *EventHandler) int
- func (t *Tab) WaitRequest(L *lua.LState) int
- func (t *Tab) WaitResponse(L *lua.LState) int
- func (t *Tab) WaitVisible(L *lua.LState)
- func (t *Tab) WaitXPath(L *lua.LState)
- func (t *Tab) WaitXPathVisible(L *lua.LState)
Constants ¶
View Source
const ( SourceWidth = 600 LineHeight = 20 )
Variables ¶
View Source
var ( Version = "HEAD" Commit = "UNKNOWN" )
View Source
var (
NoRecord = errors.New("no record")
)
View Source
var (
Palette = append(palette.WebSafe, color.Transparent)
)
Functions ¶
func AsFileLikeMeta ¶
func AsyncRun ¶
func AsyncRun[T any](env *Environment, L *lua.LState, f func() (T, error)) T
AsyncRun makes a chance to execute callback function while executing a heavy function.
func HandleError ¶
func HandleError(L *lua.LState, err error)
func LValueToString ¶
func LValueToString(v lua.LValue) string
func NewContext ¶
func NewContext(arg Arg, debuglog *ayd.Logger) (context.Context, context.CancelFunc)
func NewElementsTable ¶
func NewElementsTableByXPath ¶
func NewExecAllocator ¶
func PackFetchHeader ¶
func PackFetchResponse ¶
func PackFetchResponse(env *Environment, L *lua.LState, resp *http.Response, body io.Reader) lua.LValue
func PackLValue ¶
func PackLValue(L *lua.LState, value any) lua.LValue
func RegisterAssert ¶
func RegisterAssert(L *lua.LState)
func RegisterElementType ¶
func RegisterEncodings ¶
func RegisterEncodings(env *Environment)
func RegisterFetch ¶
func RegisterFetch(ctx context.Context, env *Environment)
func RegisterFileLike ¶
func RegisterFileLike(L *lua.LState)
func RegisterKey ¶
func RegisterKey(L *lua.LState)
func RegisterLogger ¶
func RegisterLogger(L *lua.LState, logger *Logger)
func RegisterTabType ¶
func RegisterTabType(ctx context.Context, env *Environment)
func RegisterTime ¶
func RegisterTime(ctx context.Context, env *Environment)
func URLToTable ¶
func URLToTable(L *lua.LState, u *ayd.URL) *lua.LTable
func UnpackFetchHeader ¶
func UnpackLValue ¶
func UnpackLValue(v lua.LValue) any
Types ¶
type Arg ¶
type Arg struct { Mode string Args []string Target *ayd.URL Alert ayd.Record Timeout time.Duration Debug bool Head bool Recording bool }
func (Arg) ArtifactDir ¶
type CookieJar ¶
type CookieJar struct {
// contains filtered or unexported fields
}
func CheckCookieJar ¶
func NewCookieJar ¶
func (*CookieJar) CookiesAsLua ¶
type DelayedReader ¶
type DelayedReader struct {
// contains filtered or unexported fields
}
func NewDelayedReader ¶
func NewDelayedReader(f func() io.Reader) *DelayedReader
type Element ¶
type Element struct {
// contains filtered or unexported fields
}
func CheckElement ¶
func CheckElement(L *lua.LState) Element
func NewElement ¶
func (Element) GetAttribute ¶
func (Element) GetInnerHTML ¶
func (Element) GetOuterHTML ¶
func (Element) Screenshot ¶
func (e Element) Screenshot(L *lua.LState)
type Environment ¶
type Environment struct { sync.Mutex // this mutex works like the GIL in Python. EnableRecording bool // contains filtered or unexported fields }
func NewEnvironment ¶
func (*Environment) BuildTable ¶
func (env *Environment) BuildTable(build func(L *lua.LState, tbl *lua.LTable)) *lua.LTable
func (*Environment) CallEventHandler ¶
func (env *Environment) CallEventHandler(f *lua.LFunction, arg *lua.LTable, nret int) []lua.LValue
CallEventHandler calls an event callback function with GIL.
func (*Environment) Close ¶
func (env *Environment) Close() error
func (*Environment) DoFile ¶
func (env *Environment) DoFile(path string) error
func (*Environment) NewFunction ¶
func (env *Environment) NewFunction(f lua.LGFunction) *lua.LFunction
func (*Environment) RecordOnAllTabs ¶
func (env *Environment) RecordOnAllTabs(L *lua.LState, taskName string)
func (*Environment) RegisterFunction ¶
func (env *Environment) RegisterFunction(name string, f lua.LGFunction)
func (*Environment) RegisterNewType ¶
func (env *Environment) RegisterNewType(name string, methods map[string]lua.LGFunction, fields map[string]lua.LValue)
func (*Environment) RegisterTable ¶
func (env *Environment) RegisterTable(name string, fields, meta map[string]lua.LValue)
func (*Environment) StartTask ¶
func (env *Environment) StartTask(where, taskName string)
func (*Environment) Yield ¶
func (env *Environment) Yield()
Yield makes a chance to execute callback function.
type EventHandleFunc ¶
type EventHandleFunc func(*Tab, *lua.LFunction, *lua.LTable)
type EventHandler ¶
func NewEventHandler ¶
func NewEventHandler(handle EventHandleFunc) *EventHandler
func (*EventHandler) Close ¶
func (h *EventHandler) Close() error
func (*EventHandler) Invoke ¶
func (h *EventHandler) Invoke(tab *Tab, event *lua.LTable)
func (*EventHandler) IsFuncSet ¶
func (h *EventHandler) IsFuncSet() bool
func (*EventHandler) SetFunc ¶
func (h *EventHandler) SetFunc(f *lua.LFunction)
func (*EventHandler) Status ¶
func (h *EventHandler) Status(L *lua.LState) *lua.LTable
func (*EventHandler) Wait ¶
func (h *EventHandler) Wait(ctx context.Context) *lua.LTable
type LoadWaiter ¶
func NewLoadWaiter ¶
func NewLoadWaiter() *LoadWaiter
func (*LoadWaiter) Complete ¶
func (l *LoadWaiter) Complete(id network.RequestID)
func (*LoadWaiter) Wait ¶
func (l *LoadWaiter) Wait(id network.RequestID)
type Logger ¶
type Logger struct { sync.Mutex Stream io.Writer Debug bool Logs []string Status ayd.Status Latency time.Duration LatencySet bool Extra map[string]any }
func (*Logger) SetLatency ¶
func (*Logger) UnsetLatency ¶
func (l *Logger) UnsetLatency()
type RecordAction ¶
type RecordAction struct {
// contains filtered or unexported fields
}
type Recorder ¶
type Recorder struct { Done chan struct{} // contains filtered or unexported fields }
type SourceImager ¶
func NewSourceImager ¶
func NewSourceImager() (*SourceImager, error)
func (*SourceImager) LoadAsImage ¶
func (*SourceImager) RecordStdin ¶
func (s *SourceImager) RecordStdin(lines []string)
type SourceRecordReader ¶
type Storage ¶
func (*Storage) CancelDownload ¶
func (*Storage) CompleteDownload ¶
func (*Storage) Register ¶
func (s *Storage) Register(env *Environment)
func (*Storage) StartDownload ¶
type Tab ¶
type Tab struct {
// contains filtered or unexported fields
}
func (*Tab) GetDialogs ¶
func (*Tab) GetDownload ¶
func (*Tab) GetRequest ¶
func (*Tab) GetResponse ¶
func (*Tab) GetViewport ¶
func (*Tab) HandleDialog ¶
func (t *Tab) HandleDialog(f *lua.LFunction, ev *lua.LTable)
func (*Tab) HandleEvent ¶
func (t *Tab) HandleEvent(f *lua.LFunction, ev *lua.LTable)
func (*Tab) OnDownload ¶
func (t *Tab) OnDownload(L *lua.LState)
func (*Tab) OnResponse ¶
func (t *Tab) OnResponse(L *lua.LState)
func (*Tab) RecordOnce ¶
func (*Tab) RunInCallback ¶
RunCallback execute browser action without to release GIL.
func (*Tab) RunSelector ¶
func (*Tab) Screenshot ¶
func (t *Tab) Screenshot(L *lua.LState)
func (*Tab) WaitDialog ¶
func (*Tab) WaitDownload ¶
func (*Tab) WaitEvent ¶
func (t *Tab) WaitEvent(L *lua.LState, taskName string, h *EventHandler) int
func (*Tab) WaitRequest ¶
func (*Tab) WaitResponse ¶
func (*Tab) WaitVisible ¶
func (t *Tab) WaitVisible(L *lua.LState)
func (*Tab) WaitXPathVisible ¶
func (t *Tab) WaitXPathVisible(L *lua.LState)
Click to show internal directories.
Click to hide internal directories.