ibrowser

package module
v0.0.0-...-7429402 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: GPL-3.0 Imports: 49 Imported by: 0

README

browser

chrome dev browser

Documentation

Index

Constants

View Source
const (
	TimeZone           = "Asia/Shanghai"
	UserAgentForChrome = `Mozilla/5.0 (Windows NT  6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36`
)

Chrome相关

Variables

This section is empty.

Functions

func CaptureScreen

func CaptureScreen(screenShotName, loginFlag string, sleep int64, screenShot *ScreenShotValue) chromedp.Action

抓图

func ElementScreenShot

func ElementScreenShot(sel string, res *[]byte) chromedp.Tasks

elementScreenshot takes a screenshot of a specific element.

func FullScreenShot

func FullScreenShot(quality int64, screenShotName, loginFlag string, sleep int64, screenShot *ScreenShotValue) chromedp.Tasks

FullScreenShot takes a screenshot of the entire browser viewport.

Liberally copied from puppeteer's source.

Note: this will override the viewport emulation settings.

func Message

func Message(ev interface{})

func SaveScreenShot

func SaveScreenShot(path string, screenShot *ScreenShotValue)

保存图片

Types

type Browser

type Browser struct {
	// contains filtered or unexported fields
}

func NewBrowser

func NewBrowser(ctx context.Context, downloadPath string) *Browser

func (*Browser) Close

func (brow *Browser) Close()

Close Browser对象 context取消它。

func (*Browser) NewContext

func (brow *Browser) NewContext() (context.Context, context.CancelFunc)

NewContext 在浏览器中tab可以使用context产生

type ScreenShotValue

type ScreenShotValue struct {
	ScreenShot     bool
	ScreenShotName []string
	Buf            [][]byte
}

func NewCaptureScreenShot

func NewCaptureScreenShot(ScreenShot bool) *ScreenShotValue

Jump to

Keyboard shortcuts

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