Documentation
¶
Index ¶
- Variables
- func CloseAllChrome(vm *goja.Runtime)
- type Chrome
- type ChromeInfo
- type ChromeOption
- type Element
- func (el *Element) AddClass(className string) error
- func (el *Element) Check() error
- func (el *Element) Children() ([]*Element, error)
- func (el *Element) Click() error
- func (el *Element) Find(selector string) (*Element, error)
- func (el *Element) FindAll(selector string) ([]*Element, error)
- func (el *Element) FindAllX(selector string) ([]*Element, error)
- func (el *Element) FindChild(selector string) (*Element, error)
- func (el *Element) FindChildN(selector string) *Element
- func (el *Element) FindChildren(selector string) ([]*Element, error)
- func (el *Element) FindN(selector string) *Element
- func (el *Element) FindParent(selector string) (*Element, error)
- func (el *Element) FindParentN(selector string) *Element
- func (el *Element) FindParentX(selector string) (*Element, error)
- func (el *Element) FindParentXN(selector string) *Element
- func (el *Element) FindX(selector string) (*Element, error)
- func (el *Element) FindXN(selector string) *Element
- func (el *Element) Focus() error
- func (el *Element) GetAttribute(name string) (*string, error)
- func (el *Element) GetBoundingRect() (*Rect, error)
- func (el *Element) GetCenter() (*Position, error)
- func (el *Element) GetChecked() ([]string, error)
- func (el *Element) GetClass() ([]string, error)
- func (el *Element) GetComputedStyle() (map[string]string, error)
- func (el *Element) GetForm() (*Element, error)
- func (el *Element) GetFormData() (map[string]string, error)
- func (el *Element) GetID() (*string, error)
- func (el *Element) GetName() (*string, error)
- func (el *Element) GetOptions() ([]map[string]string, error)
- func (el *Element) GetPosition() (*Position, error)
- func (el *Element) GetProperty(name string) (interface{}, error)
- func (el *Element) GetStyle(property string) (string, error)
- func (el *Element) GetType() (*string, error)
- func (el *Element) GetValue() (string, error)
- func (el *Element) HasAttribute(name string) (bool, error)
- func (el *Element) HasProperty(name string) (bool, error)
- func (el *Element) Hover() error
- func (el *Element) InnerHTML() (string, error)
- func (el *Element) Input(text string) error
- func (el *Element) IsChecked() (bool, error)
- func (el *Element) IsDisabled() (bool, error)
- func (el *Element) IsInteractable() (bool, error)
- func (el *Element) IsVisible() (bool, error)
- func (el *Element) Key(keys ...string) error
- func (el *Element) KeyPress(keys ...string) error
- func (el *Element) KeyRelease(keys ...string) error
- func (el *Element) KeyType(keys ...string) error
- func (el *Element) OuterHTML() (string, error)
- func (el *Element) Parent() (*Element, error)
- func (el *Element) RadioGroupValue() (string, error)
- func (el *Element) RemoveAttribute(name string) error
- func (el *Element) RemoveClass(className string) error
- func (el *Element) RemoveProperty(name string) error
- func (el *Element) ScrollIntoView() error
- func (el *Element) Select(values ...string) error
- func (el *Element) SelectByText(text string) error
- func (el *Element) SelectByValue(value string) error
- func (el *Element) SetAttribute(name, value string) error
- func (el *Element) SetChecked(checked bool) error
- func (el *Element) SetInnerHTML(html string) error
- func (el *Element) SetProperty(name string, value interface{}) error
- func (el *Element) SetRadioGroupValue(value string) error
- func (el *Element) SetRadioValue(value string) error
- func (el *Element) SetStyle(property, value string) error
- func (el *Element) SetText(text string) error
- func (el *Element) SetValue(value string) error
- func (el *Element) Submit() error
- func (el *Element) Text() (string, error)
- func (el *Element) Uncheck() error
- func (el *Element) UploadFile(filePaths []string) error
- func (el *Element) WaitEnabled() error
- func (el *Element) WaitInvisible() error
- func (el *Element) WaitStable(ms *int) error
- func (el *Element) WaitVisible() error
- type Http
- func (hc *Http) Connect(argsIn goja.FunctionCall, vm *goja.Runtime) goja.Value
- func (hc *Http) Delete(argsIn goja.FunctionCall, vm *goja.Runtime) goja.Value
- func (hc *Http) Do(argsIn goja.FunctionCall, vm *goja.Runtime) goja.Value
- func (hc *Http) Download(argsIn goja.FunctionCall, vm *goja.Runtime) goja.Value
- func (hc *Http) Get(argsIn goja.FunctionCall, vm *goja.Runtime) goja.Value
- func (hc *Http) Head(argsIn goja.FunctionCall, vm *goja.Runtime) goja.Value
- func (hc *Http) Post(argsIn goja.FunctionCall, vm *goja.Runtime) goja.Value
- func (hc *Http) Put(argsIn goja.FunctionCall, vm *goja.Runtime) goja.Value
- func (hc *Http) Upload(argsIn goja.FunctionCall, vm *goja.Runtime) goja.Value
- type Page
- func (pg *Page) AccepDialog() error
- func (pg *Page) Back() error
- func (pg *Page) Close() error
- func (pg *Page) DismissDialog() error
- func (pg *Page) Eval(js string) (interface{}, error)
- func (pg *Page) Find(selector string) (*Element, error)
- func (pg *Page) FindAll(selector string) ([]*Element, error)
- func (pg *Page) FindAllX(xpath string) ([]*Element, error)
- func (pg *Page) FindN(selector string) *Element
- func (pg *Page) FindX(xpath string) (*Element, error)
- func (pg *Page) FindXN(selector string) *Element
- func (pg *Page) Forward() error
- func (pg *Page) Frame(selector string) (*Page, error)
- func (pg *Page) GetCookies() (map[string]string, error)
- func (pg *Page) GetResContent(url string) ([]byte, error)
- func (pg *Page) GetResList() ([]Resource, error)
- func (pg *Page) GetResListByMimeType(mimeType string) ([]Resource, error)
- func (pg *Page) GetResListByType(resType string) ([]Resource, error)
- func (pg *Page) HandleDialog(accept bool, promptText string) error
- func (pg *Page) Html() (string, error)
- func (pg *Page) Key(keys ...string) error
- func (pg *Page) KeyPress(keys ...string) error
- func (pg *Page) KeyRelease(keys ...string) error
- func (pg *Page) KeyType(keys ...string) error
- func (pg *Page) MouseClick() error
- func (pg *Page) MouseDown() error
- func (pg *Page) MouseMiddleClick() error
- func (pg *Page) MouseMoveTo(x, y float64) error
- func (pg *Page) MouseRightClick() error
- func (pg *Page) MouseUp() error
- func (pg *Page) Navigate(url string) error
- func (pg *Page) PDF() ([]byte, error)
- func (pg *Page) RandWait(msMin int, msMax int)
- func (pg *Page) ResetTimeout()
- func (pg *Page) Screenshot() ([]byte, error)
- func (pg *Page) ScreenshotFullPage() ([]byte, error)
- func (pg *Page) ScrollTo(x, y float64) error
- func (pg *Page) SetCookies(cookies map[string]string) error
- func (pg *Page) SetPhoneViewport(width, height int) error
- func (pg *Page) SetPrompt(text string) error
- func (pg *Page) SetUserAgent(ua string) error
- func (pg *Page) SetUserAgentInfo(ua string, platform string, acceptLanguage string) error
- func (pg *Page) SetViewport(width, height int) error
- func (pg *Page) Title() (string, error)
- func (pg *Page) Url() (string, error)
- func (pg *Page) Wait(ms int, fn *func() bool)
- func (pg *Page) WaitIdle(ms *int) error
- func (pg *Page) WaitPageLoad() error
- type Position
- type Rect
- type Resource
- type WS
- func (ws *WS) Close(argsIn goja.FunctionCall, vm *goja.Runtime) goja.Value
- func (ws *WS) Ping(argsIn goja.FunctionCall, vm *goja.Runtime) goja.Value
- func (ws *WS) PingCount(argsIn goja.FunctionCall, vm *goja.Runtime) goja.Value
- func (ws *WS) Read(argsIn goja.FunctionCall, vm *goja.Runtime) goja.Value
- func (ws *WS) Write(argsIn goja.FunctionCall, vm *goja.Runtime) goja.Value
- func (ws *WS) WriteMessage(argsIn goja.FunctionCall, vm *goja.Runtime) goja.Value
Constants ¶
This section is empty.
Variables ¶
var KeyMap = map[string]input.Key{}/* 182 elements not displayed */
Functions ¶
func CloseAllChrome ¶ added in v0.0.4
Types ¶
type Chrome ¶ added in v0.0.4
type Chrome struct {
// contains filtered or unexported fields
}
func StartChrome ¶ added in v0.0.4
func StartChrome(opt *ChromeOption, vm *goja.Runtime) (*Chrome, error)
type ChromeInfo ¶ added in v0.0.7
type ChromeOption ¶ added in v0.0.7
type Element ¶ added in v0.0.4
type Element struct {
// contains filtered or unexported fields
}
func (*Element) FindChildN ¶ added in v0.0.4
func (*Element) FindChildren ¶ added in v0.0.4
FindAll 在当前元素下查找所有匹配选择器的元素
func (*Element) FindParent ¶ added in v0.0.4
FindParent 向上查找匹配选择器的父元素
func (*Element) FindParentN ¶ added in v0.0.4
func (*Element) FindParentX ¶ added in v0.0.4
FindParent 向上查找匹配选择器的父元素
func (*Element) FindParentXN ¶ added in v0.0.4
func (*Element) GetAttribute ¶ added in v0.0.4
GetAttribute 获取元素属性值 name: 属性名称 返回值: 属性值字符串,若不存在则返回空字符串
func (*Element) GetBoundingRect ¶ added in v0.0.4
func (*Element) GetChecked ¶ added in v0.0.4
GetSelectedValues 获取当前选中的值(单选返回字符串,多选返回切片)
func (*Element) GetComputedStyle ¶ added in v0.0.4
GetComputedStyle 获取元素所有计算样式
func (*Element) GetFormData ¶ added in v0.0.4
GetFormData 获取表单数据
func (*Element) GetOptions ¶ added in v0.0.4
GetAllOptions 获取所有选项(值和文本)
func (*Element) GetPosition ¶ added in v0.0.4
GetPosition 获取元素位置(中心点)
func (*Element) GetProperty ¶ added in v0.0.4
GetProperty 获取 JavaScript 属性值 name: 属性名称 返回值: 属性值(interface{} 类型)
func (*Element) HasAttribute ¶ added in v0.0.4
HasAttribute 检查属性是否存在
func (*Element) HasProperty ¶ added in v0.0.4
HasProperty 检查属性是否存在
func (*Element) IsDisabled ¶ added in v0.0.4
IsDisabled 判断元素是否被禁用
func (*Element) IsInteractable ¶ added in v0.0.4
IsInteractable 元素是否可交互
func (*Element) KeyRelease ¶ added in v0.0.6
func (*Element) RadioGroupValue ¶ added in v0.0.4
RadioGroupValue 获取单选按钮组的当前值
func (*Element) RemoveAttribute ¶ added in v0.0.4
RemoveAttribute 移除元素属性 name: 要移除的属性名称
func (*Element) RemoveClass ¶ added in v0.0.4
func (*Element) RemoveProperty ¶ added in v0.0.4
func (*Element) ScrollIntoView ¶ added in v0.0.4
func (*Element) SelectByText ¶ added in v0.0.4
SelectByText 通过文本选择选项
func (*Element) SelectByValue ¶ added in v0.0.4
SelectByValue 通过值选择选项
func (*Element) SetAttribute ¶ added in v0.0.4
SetAttribute 设置元素属性值 name: 属性名称 value: 属性值
func (*Element) SetChecked ¶ added in v0.0.4
SetChecked 设置复选框/单选框的选中状态
func (*Element) SetInnerHTML ¶ added in v0.0.4
func (*Element) SetProperty ¶ added in v0.0.4
SetProperty 设置 JavaScript 属性 name: 属性名称 value: 属性值(可以是任意类型)
func (*Element) SetRadioGroupValue ¶ added in v0.0.4
SetRadioGroupValue 设置单选按钮组的值
func (*Element) SetRadioValue ¶ added in v0.0.4
SetRadioValue 设置单选框值
func (*Element) UploadFile ¶ added in v0.0.4
func (*Element) WaitEnabled ¶ added in v0.0.4
func (*Element) WaitInvisible ¶ added in v0.0.4
func (*Element) WaitStable ¶ added in v0.0.4
func (*Element) WaitVisible ¶ added in v0.0.4
type Http ¶
type Http struct {
// contains filtered or unexported fields
}
type Page ¶ added in v0.0.4
type Page struct {
// contains filtered or unexported fields
}
func (*Page) AccepDialog ¶ added in v0.0.4
AutoAcceptAlerts 自动接受所有弹框
func (*Page) DismissDialog ¶ added in v0.0.4
AutoDismissAlerts 自动取消所有弹框
func (*Page) GetResContent ¶ added in v0.0.4
func (*Page) GetResList ¶ added in v0.0.4
func (*Page) GetResListByMimeType ¶ added in v0.0.4
func (*Page) GetResListByType ¶ added in v0.0.4
func (*Page) HandleDialog ¶ added in v0.0.4
HandleDialog 设置弹框处理器 示例:pg.HandleDialog(true, "") 接受所有弹框
func (*Page) KeyRelease ¶ added in v0.0.6
func (*Page) MouseClick ¶ added in v0.0.4
func (*Page) MouseMiddleClick ¶ added in v0.0.4
func (*Page) MouseMoveTo ¶ added in v0.0.4
func (*Page) MouseRightClick ¶ added in v0.0.4
func (*Page) ResetTimeout ¶ added in v0.0.5
func (pg *Page) ResetTimeout()
func (*Page) Screenshot ¶ added in v0.0.4
func (*Page) ScreenshotFullPage ¶ added in v0.0.4
Screenshot 截图
func (*Page) SetCookies ¶ added in v0.0.4
func (*Page) SetPhoneViewport ¶ added in v0.0.4
func (*Page) SetUserAgent ¶ added in v0.0.4
func (*Page) SetUserAgentInfo ¶ added in v0.0.4
func (*Page) SetViewport ¶ added in v0.0.4
SetViewport 设置视口大小