chrome

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chrome

type Chrome struct {
	Addr    string
	DataDir string
	Process *os.Process
}

func Create

func Create(filename string, opts []string) (*Chrome, error)

func New

func New(opts []string) (*Chrome, error)

Create chrome client

func (*Chrome) Close

func (chrome *Chrome) Close() error

Close chrome

func (*Chrome) Find

func (chrome *Chrome) Find(kw string) (*Tab, error)

Catch tab

func (*Chrome) Open

func (chrome *Chrome) Open(url string) (*Tab, error)

Open new tab

type Error

type Error struct {
	Id    int
	Error struct {
		Code    int
		Data    string
		Message string
	}
}

type Event

type Event struct {
	Method string
	Params interface{}
}

type Return

type Return struct {
	Id     int
	Result interface{}
}

type Tab

type Tab struct {
	Id                   string `json:"id"`
	Url                  string `json:"url"`
	Type                 string `json:"type"`
	Title                string `json:"title"`
	DevtoolsFrontendUrl  string `json:"devtoolsFrontendUrl"`
	WebSocketDebuggerUrl string `json:"webSocketDebuggerUrl"`
	Ipc                  ipc    `json:"-"`
}

func (*Tab) Capture

func (tab *Tab) Capture(filename string, quality int, viewport page.Viewport) error

页面截图

func (*Tab) Check

func (tab *Tab) Check(selector string, checked bool) error

选择

func (*Tab) Click

func (tab *Tab) Click(selector string) error

元素点击

func (*Tab) Close

func (tab *Tab) Close() error

关闭标签

func (*Tab) HandleEvent

func (tab *Tab) HandleEvent(method string, params interface{}) error

func (*Tab) HandleResult

func (tab *Tab) HandleResult(returns interface{}) error

func (*Tab) Input

func (tab *Tab) Input(selector, v string) error

输入值

func (*Tab) Js

func (tab *Tab) Js(js string, timeout runtime.TimeDelta) (object runtime.RemoteObject, err error)

运行Javascript

func (*Tab) Jump

func (tab *Tab) Jump(url string) error

跳转地址

func (*Tab) Query

func (tab *Tab) Query(selector string) ([]dom.NodeId, error)

查询节点

func (*Tab) Refresh

func (tab *Tab) Refresh() error

页面刷新

func (*Tab) Select

func (tab *Tab) Select(selector, v string) error

下拉框

func (*Tab) Send

func (tab *Tab) Send(method string, params interface{}) error

发起命令

func (*Tab) Text

func (tab *Tab) Text(selector string) string

获取文本信息

func (*Tab) Value

func (tab *Tab) Value(selector string) string

元素值

func (*Tab) Wait

func (tab *Tab) Wait() error

等待页面加载完成

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL