Documentation ¶
Overview ¶
Package cdp 对 github.com/chromedp/chromedp 做一层常用封装
Index ¶
- type Action
- type CDP
- func (self *CDP) Run(actions ...chromedp.Action) error
- func (self *CDP) WithAction(act chromedp.Action) *CDP
- func (self *CDP) WithActionFunc(f chromedp.ActionFunc) *CDP
- func (self *CDP) WithBrowserDebugLog(f func(string, ...interface{})) *CDP
- func (self *CDP) WithBrowserErrorLog(f func(string, ...interface{})) *CDP
- func (self *CDP) WithBrowserInfoLog(f func(string, ...interface{})) *CDP
- func (self *CDP) WithChromePath(path string) *CDP
- func (self *CDP) WithDevice(dev chromedp.Device) *CDP
- func (self *CDP) WithEnv(vars ...string) *CDP
- func (self *CDP) WithFlag(name string, value interface{}) *CDP
- func (self *CDP) WithSleep(sl time.Duration) *CDP
- func (self *CDP) WithTimeout(t time.Duration) *CDP
- func (self *CDP) WithUserAgent(ua string) *CDP
- func (self *CDP) WithViewport(width, height int64) *CDP
- func (self *CDP) WithWindowSize(width, height int) *CDP
- func (self *CDP) WithoutHeadless() *CDP
- type Helper
- func (self *Helper) FullScreen(quality int64, buf *[]byte) error
- func (self *Helper) Init() *CDP
- func (self *Helper) InnerHTML(sel string, buf *string, opts ...chromedp.QueryOption) error
- func (self *Helper) WithCookie(cookie map[string]interface{}) error
- func (self *Helper) WithCookies(cookies []map[string]interface{}) error
- func (self *Helper) WithDebugLogger(f func(string, ...interface{})) *Helper
- func (self *Helper) WithErrorLogger(f func(string, ...interface{})) *Helper
- func (self *Helper) WithInfoLogger(f func(string, ...interface{})) *Helper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct{}
func (*Action) FullScreen ¶
func (*Action) SetCookies ¶
func (self *Action) SetCookies(cookies []*network.CookieParam) chromedp.Action
type CDP ¶
type CDP struct {
// contains filtered or unexported fields
}
func (*CDP) WithAction ¶
WithAction 添加自定义Action
func (*CDP) WithActionFunc ¶
func (self *CDP) WithActionFunc(f chromedp.ActionFunc) *CDP
WithActionFunc 接受一个func,用户自定义丰富的Action过程
func (*CDP) WithBrowserDebugLog ¶
WithBrowserLog 设置启动浏览器日志
func (*CDP) WithBrowserErrorLog ¶
func (*CDP) WithBrowserInfoLog ¶
func (*CDP) WithChromePath ¶
WithChromePath 设置chrome的执行路径
func (*CDP) WithUserAgent ¶
WithUserAgent 设置UserAgent
func (*CDP) WithViewport ¶
WithViewport 设置展示区域的尺寸
func (*CDP) WithWindowSize ¶
WithWindowSize 设置浏览器窗口的宽高
func (*CDP) WithoutHeadless ¶
WithoutHeadless 设置关闭headless 设置了这个选项后,chromedp在执行过程中会启动chrome的GUI,用于观察chrome的行为
type Helper ¶
type Helper struct {
// contains filtered or unexported fields
}
func (*Helper) WithCookie ¶
func (*Helper) WithCookies ¶
func (*Helper) WithDebugLogger ¶
func (*Helper) WithErrorLogger ¶
func (*Helper) WithInfoLogger ¶
Click to show internal directories.
Click to hide internal directories.