Documentation ¶
Index ¶
- Constants
- func MustToJSONBytes(data interface{}) ([]byte, error)
- func OutputFile(p string, data interface{}) error
- type Browser
- type BrowserManager
- type BrowserPool
- type BrowserPoolManager
- type Logger
- type Page
- func (p *Page) Close() error
- func (p *Page) Element(selector, jsRegex string) (*rod.Element, error)
- func (p *Page) Elements(selector string) (rod.Elements, error)
- func (p *Page) Eval(s string, args ...interface{}) (*proto.RuntimeRemoteObject, error)
- func (p *Page) Prepare(url string, headers []string, viewport *PageViewportOpts) error
- func (p *Page) Screenshot(file string, full bool) error
- func (p *Page) ScreenshotFullPage(file string) error
- func (p *Page) Scroll(offsetX, offsetY float64, steps int) error
- func (p *Page) ScrollDown(sleep time.Duration) error
- func (p *Page) ScrollHeight() (float64, float64, error)
- type PageManager
- type PagePool
- type PagePoolManager
- type PageViewportOpts
Constants ¶
View Source
const ( InputMouseButtonLeft = proto.InputMouseButtonLeft InputMouseButtonMiddle = proto.InputMouseButtonMiddle InputMouseButtonRight = proto.InputMouseButtonRight InputMouseButtonBack = proto.InputMouseButtonBack InputMouseButtonForward = proto.InputMouseButtonForward )
View Source
const ( InputMouseButtonSingleClick = 1 MouseButtonDoubleClick = 2 )
Variables ¶
This section is empty.
Functions ¶
func MustToJSONBytes ¶
MustToJSONBytes encode data to json bytes
func OutputFile ¶
OutputFile auto creates file if not exists, it will try to detect the data type and auto output binary, string or json
Types ¶
type Browser ¶
func NewBrowser ¶
func (*Browser) WaitDownload ¶
func (b *Browser) WaitDownload(dir string) func() (info *proto.PageDownloadWillBegin)
type BrowserManager ¶
type BrowserPool ¶
type BrowserPool struct {
Pool chan BrowserManager
}
func NewBrowserPool ¶
func NewBrowserPool(workers int) *BrowserPool
func (*BrowserPool) Cleanup ¶
func (p *BrowserPool) Cleanup() error
func (*BrowserPool) Put ¶
func (p *BrowserPool) Put(b BrowserManager)
type BrowserPoolManager ¶
type BrowserPoolManager interface { Get(url string) (*Browser, error) Put(b BrowserManager) Cleanup() error }
type Page ¶
func NewPage ¶
func NewPage(b BrowserManager) (*Page, error)
func (*Page) Eval ¶
func (p *Page) Eval(s string, args ...interface{}) (*proto.RuntimeRemoteObject, error)
func (*Page) Prepare ¶
func (p *Page) Prepare(url string, headers []string, viewport *PageViewportOpts) error
func (*Page) ScreenshotFullPage ¶
type PageManager ¶
type PageManager interface { Prepare(url string, headers []string, viewport *PageViewportOpts) error Close() error Eval(s string, args ...interface{}) (*proto.RuntimeRemoteObject, error) Scroll(offsetX, offsetY float64, steps int) error ScrollHeight() (float64, float64, error) ScrollDown(sleep time.Duration) error Elements(selector string) (rod.Elements, error) Screenshot(file string, full bool) error ScreenshotFullPage(file string) error }
type PagePool ¶
type PagePool struct {
Pool chan PageManager
}
func NewPagePool ¶
func (PagePool) Put ¶
func (pp PagePool) Put(p PageManager)
type PagePoolManager ¶
type PagePoolManager interface { Get(browser BrowserManager) (*Page, error) Put(p PageManager) Cleanup() error }
type PageViewportOpts ¶
Click to show internal directories.
Click to hide internal directories.