{"modulePath":"github.com/GoCodeAlone/rod","version":"v0.116.3","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package rod\n\nPackage rod is a high-level driver directly based on DevTools Protocol.\n\n## Variables\n\n```go\nvar DefaultLogger = log.New(os.Stdout, \"[rod] \", log.LstdFlags)\n```\nDefaultLogger for rod.\n\n```go\nvar DefaultSleeper = func() utils.Sleeper {\n\treturn utils.BackoffSleeper(100*time.Millisecond, time.Second, nil)\n}\n```\nDefaultSleeper generates the default sleeper for retry, it uses backoff to grow the interval. The growth looks like:\n\n\tA(0) = 100ms, A(n) = A(n-1) * random[1.9, 2.1), A(n) \u003c 1s\n\nWhy the default is not RequestAnimationFrame or DOM change events is because of if a retry never ends it can easily flood the program. But you can always easily config it into what you want.\n\n## Functions\n\n```go\nfunc NotFoundSleeper() utils.Sleeper\n```\nNotFoundSleeper returns ErrElementNotFound on the first call.\n\n```go\nfunc Try(fn func()) (err error)\n```\nTry try fn with recover, return the panic as rod.ErrTry.\n\n## Types\n\n```go\ntype Browser struct {\n\t// BrowserContextID is the id for incognito window\n\tBrowserContextID proto.BrowserBrowserContextID\n\t// contains filtered or unexported fields\n}\n```\nBrowser represents the browser. It doesn't depends on file system, it should work with remote browser seamlessly. To check the env var you can use to quickly enable options from CLI, check here: [https://pkg.go.dev/github.com/GoCodeAlone/rod/lib/defaults](https://pkg.go.dev/github.com/GoCodeAlone/rod/lib/defaults)\n\n```go\nfunc New() *Browser\n```\nNew creates a controller. DefaultDevice to emulate is set to [devices.LaptopWithMDPIScreen](/github.com/GoCodeAlone/rod/lib/devices#LaptopWithMDPIScreen).Landscape(), it will change the default user-agent and can make the actual view area smaller than the browser window on headful mode, you can use [Browser.NoDefaultDevice](#Browser.NoDefaultDevice) to disable it.\n\n```go\nfunc (b *Browser) Call(ctx context.Context, sessionID, methodName string, params interface{}) (res []byte, err error)\n```\nCall implements the [proto.Client](/github.com/GoCodeAlone/rod/lib/proto#Client) to call raw cdp interface directly.\n\n```go\nfunc (b *Browser) CancelTimeout() *Browser\n```\nCancelTimeout cancels the current timeout context and returns a clone with the parent context.\n\n```go\nfunc (b *Browser) Client(c CDPClient) *Browser\n```\nClient set the cdp client.\n\n```go\nfunc (b *Browser) Close() error\n```\nClose the browser.\n\n```go\nfunc (b *Browser) Connect() error\n```\nConnect to the browser and start to control it. If fails to connect, try to launch a local browser, if local browser not found try to download one.\n\n```go\nfunc (b *Browser) Context(ctx context.Context) *Browser\n```\nContext returns a clone with the specified ctx for chained sub-operations.\n\n```go\nfunc (b *Browser) ControlURL(url string) *Browser\n```\nControlURL set the url to remote control browser.\n\n```go\nfunc (b *Browser) DefaultDevice(d devices.Device) *Browser\n```\nDefaultDevice sets the default device for new page to emulate in the future. Default is [devices.LaptopWithMDPIScreen](/github.com/GoCodeAlone/rod/lib/devices#LaptopWithMDPIScreen). Set it to [devices.Clear](/github.com/GoCodeAlone/rod/lib/devices#Clear) to disable it.\n\n```go\nfunc (b *Browser) DisableDomain(sessionID proto.TargetSessionID, req proto.Request) (restore func())\n```\nDisableDomain and returns a restore function to restore previous state.\n\n```go\nfunc (b *Browser) EachEvent(callbacks ...interface{}) (wait func())\n```\nEachEvent is similar to [Page.EachEvent](#Page.EachEvent), but catches events of the entire browser.\n\n```go\nfunc (b *Browser) EnableDomain(sessionID proto.TargetSessionID, req proto.Request) (restore func())\n```\nEnableDomain and returns a restore function to restore previous state.\n\n```go\nfunc (b *Browser) Event() \u003c-chan *Message\n```\nEvent of the browser.\n\n```go\nfunc (b *Browser) GetContext() context.Context\n```\nGetContext of current instance.\n\n```go\nfunc (b *Browser) GetCookies() ([]*proto.NetworkCookie, error)\n```\nGetCookies from the browser.\n\n```go\nfunc (b *Browser) HandleAuth(username, password string) func() error\n```\nHandleAuth for the next basic HTTP authentication. It will prevent the popup that requires user to input user name and password. Ref: [https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication)\n\n```go\nfunc (b *Browser) HijackRequests() *HijackRouter\n```\nHijackRequests same as Page.HijackRequests, but can intercept requests of the entire browser.\n\n```go\nfunc (b *Browser) IgnoreCertErrors(enable bool) error\n```\nIgnoreCertErrors switch. If enabled, all certificate errors will be ignored.\n\n```go\nfunc (b *Browser) Incognito() (*Browser, error)\n```\nIncognito creates a new incognito browser.\n\n```go\nfunc (b *Browser) LoadState(sessionID proto.TargetSessionID, method proto.Request) (has bool)\n```\nLoadState into the method, sessionID can be empty.\n\n```go\nfunc (b *Browser) Logger(l utils.Logger) *Browser\n```\nLogger overrides the default log functions for tracing.\n\n```go\nfunc (b *Browser) Monitor(url string) *Browser\n```\nMonitor address to listen if not empty. Shortcut for [Browser.ServeMonitor](#Browser.ServeMonitor).\n\n```go\nfunc (b *Browser) MustClose()\n```\nMustClose is similar to [Browser.Close](#Browser.Close).\n\n```go\nfunc (b *Browser) MustConnect() *Browser\n```\nMustConnect is similar to [Browser.Connect](#Browser.Connect).\n\n```go\nfunc (b *Browser) MustGetCookies() []*proto.NetworkCookie\n```\nMustGetCookies is similar to [Browser.GetCookies](#Browser.GetCookies).\n\n```go\nfunc (b *Browser) MustHandleAuth(username, password string) (wait func())\n```\nMustHandleAuth is similar to [Browser.HandleAuth](#Browser.HandleAuth).\n\n```go\nfunc (b *Browser) MustIgnoreCertErrors(enable bool) *Browser\n```\nMustIgnoreCertErrors is similar to [Browser.IgnoreCertErrors](#Browser.IgnoreCertErrors).\n\n```go\nfunc (b *Browser) MustIncognito() *Browser\n```\nMustIncognito is similar to [Browser.Incognito](#Browser.Incognito).\n\n```go\nfunc (b *Browser) MustPage(url ...string) *Page\n```\nMustPage is similar to [Browser.Page](#Browser.Page). The url list will be joined by \"/\".\n\n```go\nfunc (b *Browser) MustPageFromTargetID(targetID proto.TargetTargetID) *Page\n```\nMustPageFromTargetID is similar to \\[Browser.PageFromTargetID].\n\n```go\nfunc (b *Browser) MustPages() Pages\n```\nMustPages is similar to [Browser.Pages](#Browser.Pages).\n\n```go\nfunc (b *Browser) MustSetCookies(cookies ...*proto.NetworkCookie) *Browser\n```\nMustSetCookies is similar to [Browser.SetCookies](#Browser.SetCookies). If the len(cookies) is 0 it will clear all the cookies.\n\n```go\nfunc (b *Browser) MustVersion() *proto.BrowserGetVersionResult\n```\nMustVersion is similar to [Browser.Version](#Browser.Version).\n\n```go\nfunc (b *Browser) MustWaitDownload() func() []byte\n```\nMustWaitDownload is similar to [Browser.WaitDownload](#Browser.WaitDownload). It will read the file into bytes then remove the file.\n\n```go\nfunc (b *Browser) NoDefaultDevice() *Browser\n```\nNoDefaultDevice is the same as [Browser.DefaultDevice](#Browser.DefaultDevice)(devices.Clear).\n\n```go\nfunc (b *Browser) Page(opts proto.TargetCreateTarget) (p *Page, err error)\n```\nPage creates a new browser tab. If opts.URL is empty, the default target will be \"about:blank\".\n\n```go\nfunc (b *Browser) PageFromSession(sessionID proto.TargetSessionID) *Page\n```\nPageFromSession is used for low-level debugging.\n\n```go\nfunc (b *Browser) PageFromTarget(targetID proto.TargetTargetID) (*Page, error)\n```\nPageFromTarget gets or creates a Page instance.\n\n```go\nfunc (b *Browser) Pages() (Pages, error)\n```\nPages retrieves all visible pages.\n\n```go\nfunc (b *Browser) RemoveState(key interface{})\n```\nRemoveState a state.\n\n```go\nfunc (b *Browser) ServeMonitor(host string) string\n```\nServeMonitor starts the monitor server. The reason why not to use \"chrome://inspect/#devices\" is one target cannot be driven by multiple controllers.\n\n```go\nfunc (b *Browser) SetCookies(cookies []*proto.NetworkCookieParam) error\n```\nSetCookies to the browser. If the cookies is nil it will clear all the cookies.\n\n```go\nfunc (b *Browser) Sleeper(sleeper func() utils.Sleeper) *Browser\n```\nSleeper returns a clone with the specified sleeper for chained sub-operations.\n\n```go\nfunc (b *Browser) SlowMotion(delay time.Duration) *Browser\n```\nSlowMotion set the delay for each control action, such as the simulation of the human inputs.\n\n```go\nfunc (b *Browser) Timeout(d time.Duration) *Browser\n```\nTimeout returns a clone with the specified total timeout of all chained sub-operations.\n\n```go\nfunc (b *Browser) Trace(enable bool) *Browser\n```\nTrace enables/disables the visual tracing of the input actions on the page.\n\n```go\nfunc (b *Browser) Version() (*proto.BrowserGetVersionResult, error)\n```\nVersion info of the browser.\n\n```go\nfunc (b *Browser) WaitDownload(dir string) func() (info *proto.PageDownloadWillBegin)\n```\nWaitDownload returns a helper to get the next download file. The file path will be:\n\n\tfilepath.Join(dir, info.GUID)\n\n```go\nfunc (b *Browser) WaitEvent(e proto.Event) (wait func())\n```\nWaitEvent waits for the next event for one time. It will also load the data into the event object.\n\n```go\nfunc (b *Browser) WithCancel() (*Browser, func())\n```\nWithCancel returns a clone with a context cancel function.\n\n```go\nfunc (b *Browser) WithPanic(fail func(interface{})) *Browser\n```\nWithPanic returns a browser clone with the specified panic function. The fail must stop the current goroutine's execution immediately, such as use [runtime.Goexit](/runtime#Goexit) or panic inside it.\n\n```go\ntype CDPClient interface {\n\tEvent() \u003c-chan *cdp.Event\n\tCall(ctx context.Context, sessionID, method string, params interface{}) ([]byte, error)\n}\n```\nCDPClient is usually used to make rod side-effect free. Such as proxy all IO of rod.\n\n```go\ntype CoveredError struct {\n\t*Element\n}\n```\nCoveredError error.\n\n```go\nfunc (e *CoveredError) Error() string\n```\nError ...\n\n```go\nfunc (e *CoveredError) Is(err error) bool\n```\nIs interface.\n\n```go\nfunc (e *CoveredError) Unwrap() error\n```\nUnwrap ...\n\n```go\ntype Element struct {\n\tObject *proto.RuntimeRemoteObject\n\t// contains filtered or unexported fields\n}\n```\nElement represents the DOM element.\n\n```go\nfunc (el *Element) Attribute(name string) (*string, error)\n```\nAttribute of the DOM object. Attribute vs Property: [https://stackoverflow.com/questions/6003819/what-is-the-difference-between-properties-and-attributes-in-html](https://stackoverflow.com/questions/6003819/what-is-the-difference-between-properties-and-attributes-in-html)\n\n```go\nfunc (el *Element) BackgroundImage() ([]byte, error)\n```\nBackgroundImage returns the css background-image of the element.\n\n```go\nfunc (el *Element) Blur() error\n```\nBlur removes focus from the element.\n\n```go\nfunc (el *Element) Call(ctx context.Context, sessionID, methodName string, params interface{}) (res []byte, err error)\n```\nCall implements the [proto.Client](/github.com/GoCodeAlone/rod/lib/proto#Client).\n\n```go\nfunc (el *Element) CancelTimeout() *Element\n```\nCancelTimeout cancels the current timeout context and returns a clone with the parent context.\n\n```go\nfunc (el *Element) CanvasToImage(format string, quality float64) ([]byte, error)\n```\nCanvasToImage get image data of a canvas. The default format is image/png. The default quality is 0.92. doc: [https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)\n\n```go\nfunc (el *Element) Click(button proto.InputMouseButton, clickCount int) error\n```\nClick will press then release the button just like a human. Before the action, it will try to scroll to the element, hover the mouse over it, wait until the it's interactable and enabled.\n\n```go\nfunc (el *Element) ContainsElement(target *Element) (bool, error)\n```\nContainsElement check if the target is equal or inside the element.\n\n```go\nfunc (el *Element) Context(ctx context.Context) *Element\n```\nContext returns a clone with the specified ctx for chained sub-operations.\n\n```go\nfunc (el *Element) Describe(depth int, pierce bool) (*proto.DOMNode, error)\n```\nDescribe the current element. The depth is the maximum depth at which children should be retrieved, defaults to 1, use -1 for the entire subtree or provide an integer larger than 0. The pierce decides whether or not iframes and shadow roots should be traversed when returning the subtree. The returned [proto.DOMNode.NodeID](/github.com/GoCodeAlone/rod/lib/proto#DOMNode.NodeID) will always be empty, because NodeID is not stable (when [proto.DOMDocumentUpdated](/github.com/GoCodeAlone/rod/lib/proto#DOMDocumentUpdated) is fired all NodeID on the page will be reassigned to another value) we don't recommend using the NodeID, instead, use the [proto.DOMBackendNodeID](/github.com/GoCodeAlone/rod/lib/proto#DOMBackendNodeID) to identify the element.\n\n```go\nfunc (el *Element) Disabled() (bool, error)\n```\nDisabled checks if the element is disabled.\n\n```go\nfunc (el *Element) Element(selector string) (*Element, error)\n```\nElement returns the first child that matches the css selector.\n\n```go\nfunc (el *Element) ElementByJS(opts *EvalOptions) (*Element, error)\n```\nElementByJS returns the element from the return value of the js.\n\n```go\nfunc (el *Element) ElementR(selector, jsRegex string) (*Element, error)\n```\nElementR returns the first child element that matches the css selector and its text matches the jsRegex.\n\n```go\nfunc (el *Element) ElementX(xPath string) (*Element, error)\n```\nElementX returns the first child that matches the XPath selector.\n\n```go\nfunc (el *Element) Elements(selector string) (Elements, error)\n```\nElements returns all elements that match the css selector.\n\n```go\nfunc (el *Element) ElementsByJS(opts *EvalOptions) (Elements, error)\n```\nElementsByJS returns the elements from the return value of the js.\n\n```go\nfunc (el *Element) ElementsX(xpath string) (Elements, error)\n```\nElementsX returns all elements that match the XPath selector.\n\n```go\nfunc (el *Element) Equal(elm *Element) (bool, error)\n```\nEqual checks if the two elements are equal.\n\n```go\nfunc (el *Element) Eval(js string, params ...interface{}) (*proto.RuntimeRemoteObject, error)\n```\nEval is a shortcut for [Element.Evaluate](#Element.Evaluate) with AwaitPromise, ByValue and AutoExp set to true.\n\n```go\nfunc (el *Element) Evaluate(opts *EvalOptions) (*proto.RuntimeRemoteObject, error)\n```\nEvaluate is just a shortcut of [Page.Evaluate](#Page.Evaluate) with This set to current element.\n\n```go\nfunc (el *Element) Focus() error\n```\nFocus sets focus on the specified element. Before the action, it will try to scroll to the element.\n\n```go\nfunc (el *Element) Frame() (*Page, error)\n```\nFrame creates a page instance that represents the iframe.\n\n```go\nfunc (el *Element) GetContext() context.Context\n```\nGetContext of current instance.\n\n```go\nfunc (el *Element) GetSessionID() proto.TargetSessionID\n```\nGetSessionID interface.\n\n```go\nfunc (el *Element) GetXPath(optimized bool) (string, error)\n```\nGetXPath returns the xpath of the element.\n\n```go\nfunc (el *Element) HTML() (string, error)\n```\nHTML of the element.\n\n```go\nfunc (el *Element) Has(selector string) (bool, *Element, error)\n```\nHas an element that matches the css selector.\n\n```go\nfunc (el *Element) HasR(selector, jsRegex string) (bool, *Element, error)\n```\nHasR returns true if a child element that matches the css selector and its text matches the jsRegex.\n\n```go\nfunc (el *Element) HasX(selector string) (bool, *Element, error)\n```\nHasX an element that matches the XPath selector.\n\n```go\nfunc (el *Element) Hover() error\n```\nHover the mouse over the center of the element. Before the action, it will try to scroll to the element and wait until it's interactable.\n\n```go\nfunc (el *Element) Input(text string) error\n```\nInput focuses on the element and input text to it. Before the action, it will scroll to the element, wait until it's visible, enabled and writable. To empty the input you can use something like\n\n\tel.SelectAllText().MustInput(\"\")\n\n```go\nfunc (el *Element) InputColor(color string) error\n```\nInputColor focuses on the element and inputs a color string to it. Before the action, it will scroll to the element, wait until it's visible, enabled and writable.\n\n```go\nfunc (el *Element) InputTime(t time.Time) error\n```\nInputTime focuses on the element and input time to it. Before the action, it will scroll to the element, wait until it's visible, enabled and writable. It will wait until the element is visible, enabled and writable.\n\n```go\nfunc (el *Element) Interactable() (pt *proto.Point, err error)\n```\nInteractable checks if the element is interactable with cursor. The cursor can be mouse, finger, stylus, etc. If not interactable err will be ErrNotInteractable, such as when covered by a modal,.\n\n```go\nfunc (el *Element) KeyActions() (*KeyActions, error)\n```\nKeyActions is similar with Page.KeyActions. Before the action, it will try to scroll to the element and focus on it.\n\n```go\nfunc (el *Element) Matches(selector string) (bool, error)\n```\nMatches checks if the element can be selected by the css selector.\n\n```go\nfunc (el *Element) MoveMouseOut() error\n```\nMoveMouseOut of the current element.\n\n```go\nfunc (el *Element) MustAttribute(name string) *string\n```\nMustAttribute is similar to [Element.Attribute](#Element.Attribute).\n\n```go\nfunc (el *Element) MustBackgroundImage() []byte\n```\nMustBackgroundImage is similar to [Element.BackgroundImage](#Element.BackgroundImage).\n\n```go\nfunc (el *Element) MustBlur() *Element\n```\nMustBlur is similar to [Element.Blur](#Element.Blur).\n\n```go\nfunc (el *Element) MustCanvasToImage() []byte\n```\nMustCanvasToImage is similar to [Element.CanvasToImage](#Element.CanvasToImage).\n\n```go\nfunc (el *Element) MustClick() *Element\n```\nMustClick is similar to [Element.Click](#Element.Click).\n\n```go\nfunc (el *Element) MustContainsElement(target *Element) bool\n```\nMustContainsElement is similar to [Element.ContainsElement](#Element.ContainsElement).\n\n```go\nfunc (el *Element) MustDescribe() *proto.DOMNode\n```\nMustDescribe is similar to [Element.Describe](#Element.Describe).\n\n```go\nfunc (el *Element) MustDisabled() bool\n```\nMustDisabled is similar to [Element.Disabled](#Element.Disabled).\n\n```go\nfunc (el *Element) MustDoubleClick() *Element\n```\nMustDoubleClick is similar to [Element.Click](#Element.Click).\n\n```go\nfunc (el *Element) MustElement(selector string) *Element\n```\nMustElement is similar to [Element.Element](#Element.Element).\n\n```go\nfunc (el *Element) MustElementByJS(js string, params ...interface{}) *Element\n```\nMustElementByJS is similar to [Element.ElementByJS](#Element.ElementByJS).\n\n```go\nfunc (el *Element) MustElementR(selector, regex string) *Element\n```\nMustElementR is similar to [Element.ElementR](#Element.ElementR).\n\n```go\nfunc (el *Element) MustElementX(xpath string) *Element\n```\nMustElementX is similar to [Element.ElementX](#Element.ElementX).\n\n```go\nfunc (el *Element) MustElements(selector string) Elements\n```\nMustElements is similar to [Element.Elements](#Element.Elements).\n\n```go\nfunc (el *Element) MustElementsByJS(js string, params ...interface{}) Elements\n```\nMustElementsByJS is similar to [Element.ElementsByJS](#Element.ElementsByJS).\n\n```go\nfunc (el *Element) MustElementsX(xpath string) Elements\n```\nMustElementsX is similar to [Element.ElementsX](#Element.ElementsX).\n\n```go\nfunc (el *Element) MustEqual(elm *Element) bool\n```\nMustEqual is similar to [Element.Equal](#Element.Equal).\n\n```go\nfunc (el *Element) MustEval(js string, params ...interface{}) gson.JSON\n```\nMustEval is similar to [Element.Eval](#Element.Eval).\n\n```go\nfunc (el *Element) MustFocus() *Element\n```\nMustFocus is similar to [Element.Focus](#Element.Focus).\n\n```go\nfunc (el *Element) MustFrame() *Page\n```\nMustFrame is similar to [Element.Frame](#Element.Frame).\n\n```go\nfunc (el *Element) MustGetXPath(optimized bool) string\n```\nMustGetXPath is similar to [Element.GetXPath](#Element.GetXPath).\n\n```go\nfunc (el *Element) MustHTML() string\n```\nMustHTML is similar to [Element.HTML](#Element.HTML).\n\n```go\nfunc (el *Element) MustHas(selector string) bool\n```\nMustHas is similar to [Element.Has](#Element.Has).\n\n```go\nfunc (el *Element) MustHasR(selector, regex string) bool\n```\nMustHasR is similar to [Element.HasR](#Element.HasR).\n\n```go\nfunc (el *Element) MustHasX(selector string) bool\n```\nMustHasX is similar to [Element.HasX](#Element.HasX).\n\n```go\nfunc (el *Element) MustHover() *Element\n```\nMustHover is similar to [Element.Hover](#Element.Hover).\n\n```go\nfunc (el *Element) MustInput(text string) *Element\n```\nMustInput is similar to [Element.Input](#Element.Input).\n\n```go\nfunc (el *Element) MustInputColor(color string) *Element\n```\nMustInputColor is similar to [Element.InputColor](#Element.InputColor).\n\n```go\nfunc (el *Element) MustInputTime(t time.Time) *Element\n```\nMustInputTime is similar to [Element.Input](#Element.Input).\n\n```go\nfunc (el *Element) MustInteractable() bool\n```\nMustInteractable is similar to [Element.Interactable](#Element.Interactable).\n\n```go\nfunc (el *Element) MustKeyActions() *KeyActions\n```\nMustKeyActions is similar to [Element.KeyActions](#Element.KeyActions).\n\n```go\nfunc (el *Element) MustMatches(selector string) bool\n```\nMustMatches is similar to [Element.Matches](#Element.Matches).\n\n```go\nfunc (el *Element) MustMoveMouseOut() *Element\n```\nMustMoveMouseOut is similar to [Element.MoveMouseOut](#Element.MoveMouseOut).\n\n```go\nfunc (el *Element) MustNext() *Element\n```\nMustNext is similar to [Element.Next](#Element.Next).\n\n```go\nfunc (el *Element) MustParent() *Element\n```\nMustParent is similar to [Element.Parent](#Element.Parent).\n\n```go\nfunc (el *Element) MustParents(selector string) Elements\n```\nMustParents is similar to [Element.Parents](#Element.Parents).\n\n```go\nfunc (el *Element) MustPrevious() *Element\n```\nMustPrevious is similar to [Element.Previous](#Element.Previous).\n\n```go\nfunc (el *Element) MustProperty(name string) gson.JSON\n```\nMustProperty is similar to [Element.Property](#Element.Property).\n\n```go\nfunc (el *Element) MustRelease()\n```\nMustRelease is similar to [Element.Release](#Element.Release).\n\n```go\nfunc (el *Element) MustRemove()\n```\nMustRemove is similar to [Element.Remove](#Element.Remove).\n\n```go\nfunc (el *Element) MustResource() []byte\n```\nMustResource is similar to [Element.Resource](#Element.Resource).\n\n```go\nfunc (el *Element) MustScreenshot(toFile ...string) []byte\n```\nMustScreenshot is similar to [Element.Screenshot](#Element.Screenshot).\n\n```go\nfunc (el *Element) MustScrollIntoView() *Element\n```\nMustScrollIntoView is similar to [Element.ScrollIntoView](#Element.ScrollIntoView).\n\n```go\nfunc (el *Element) MustSelect(selectors ...string) *Element\n```\nMustSelect is similar to [Element.Select](#Element.Select).\n\n```go\nfunc (el *Element) MustSelectAllText() *Element\n```\nMustSelectAllText is similar to [Element.SelectAllText](#Element.SelectAllText).\n\n```go\nfunc (el *Element) MustSelectText(regex string) *Element\n```\nMustSelectText is similar to [Element.SelectText](#Element.SelectText).\n\n```go\nfunc (el *Element) MustSetFiles(paths ...string) *Element\n```\nMustSetFiles is similar to [Element.SetFiles](#Element.SetFiles).\n\n```go\nfunc (el *Element) MustShadowRoot() *Element\n```\nMustShadowRoot is similar to [Element.ShadowRoot](#Element.ShadowRoot).\n\n```go\nfunc (el *Element) MustShape() *proto.DOMGetContentQuadsResult\n```\nMustShape is similar to [Element.Shape](#Element.Shape).\n\n```go\nfunc (el *Element) MustTap() *Element\n```\nMustTap is similar to [Element.Tap](#Element.Tap).\n\n```go\nfunc (el *Element) MustText() string\n```\nMustText is similar to [Element.Text](#Element.Text).\n\n```go\nfunc (el *Element) MustType(keys ...input.Key) *Element\n```\nMustType is similar to [Element.Type](#Element.Type).\n\n```go\nfunc (el *Element) MustVisible() bool\n```\nMustVisible is similar to [Element.Visible](#Element.Visible).\n\n```go\nfunc (el *Element) MustWait(js string, params ...interface{}) *Element\n```\nMustWait is similar to [Element.Wait](#Element.Wait).\n\n```go\nfunc (el *Element) MustWaitEnabled() *Element\n```\nMustWaitEnabled is similar to [Element.WaitEnabled](#Element.WaitEnabled).\n\n```go\nfunc (el *Element) MustWaitInteractable() *Element\n```\nMustWaitInteractable is similar to [Element.WaitInteractable](#Element.WaitInteractable).\n\n```go\nfunc (el *Element) MustWaitInvisible() *Element\n```\nMustWaitInvisible is similar to [Element.WaitInvisible](#Element.WaitInvisible)..\n\n```go\nfunc (el *Element) MustWaitLoad() *Element\n```\nMustWaitLoad is similar to [Element.WaitLoad](#Element.WaitLoad).\n\n```go\nfunc (el *Element) MustWaitStable() *Element\n```\nMustWaitStable is similar to [Element.WaitStable](#Element.WaitStable).\n\n```go\nfunc (el *Element) MustWaitVisible() *Element\n```\nMustWaitVisible is similar to [Element.WaitVisible](#Element.WaitVisible).\n\n```go\nfunc (el *Element) MustWaitWritable() *Element\n```\nMustWaitWritable is similar to [Element.WaitWritable](#Element.WaitWritable).\n\n```go\nfunc (el *Element) Next() (*Element, error)\n```\nNext returns the next sibling element in the DOM tree.\n\n```go\nfunc (el *Element) Overlay(msg string) (removeOverlay func())\n```\nOverlay msg on the element.\n\n```go\nfunc (el *Element) Page() *Page\n```\nPage of the element.\n\n```go\nfunc (el *Element) Parent() (*Element, error)\n```\nParent returns the parent element in the DOM tree.\n\n```go\nfunc (el *Element) Parents(selector string) (Elements, error)\n```\nParents that match the selector.\n\n```go\nfunc (el *Element) Previous() (*Element, error)\n```\nPrevious returns the previous sibling element in the DOM tree.\n\n```go\nfunc (el *Element) Property(name string) (gson.JSON, error)\n```\nProperty of the DOM object. Property vs Attribute: [https://stackoverflow.com/questions/6003819/what-is-the-difference-between-properties-and-attributes-in-html](https://stackoverflow.com/questions/6003819/what-is-the-difference-between-properties-and-attributes-in-html)\n\n```go\nfunc (el *Element) Release() error\n```\nRelease is a shortcut for [Page.Release](#Page.Release) current element.\n\n```go\nfunc (el *Element) Remove() error\n```\nRemove the element from the page.\n\n```go\nfunc (el *Element) Resource() ([]byte, error)\n```\nResource returns the \"src\" content of current element. Such as the jpg of \\\u003cimg src=\"a.jpg\"\u003e.\n\n```go\nfunc (el *Element) Screenshot(format proto.PageCaptureScreenshotFormat, quality int) ([]byte, error)\n```\nScreenshot of the area of the element.\n\n```go\nfunc (el *Element) ScrollIntoView() error\n```\nScrollIntoView scrolls the current element into the visible area of the browser window if it's not already within the visible area.\n\n```go\nfunc (el *Element) Select(selectors []string, selected bool, t SelectorType) error\n```\nSelect the children option elements that match the selectors. Before the action, it will scroll to the element, wait until it's visible. If no option matches the selectors, it will return \\[ErrElementNotFound].\n\n```go\nfunc (el *Element) SelectAllText() error\n```\nSelectAllText selects all text Before the action, it will try to scroll to the element and focus on it.\n\n```go\nfunc (el *Element) SelectText(regex string) error\n```\nSelectText selects the text that matches the regular expression. Before the action, it will try to scroll to the element and focus on it.\n\n```go\nfunc (el *Element) SetFiles(paths []string) error\n```\nSetFiles of the current file input element.\n\n```go\nfunc (el *Element) ShadowRoot() (*Element, error)\n```\nShadowRoot returns the shadow root of this element.\n\n```go\nfunc (el *Element) Shape() (*proto.DOMGetContentQuadsResult, error)\n```\nShape of the DOM element content. The shape is a group of 4-sides polygons. A 4-sides polygon is not necessary a rectangle. 4-sides polygons can be apart from each other. For example, we use 2 4-sides polygons to describe the shape below:\n\n\t  ____________          ____________\n\t /        ___/    =    /___________/    +     _________\n\t/________/                                   /________/\n\n```go\nfunc (el *Element) Sleeper(sleeper func() utils.Sleeper) *Element\n```\nSleeper returns a clone with the specified sleeper for chained sub-operations.\n\n```go\nfunc (el *Element) String() string\n```\nString interface.\n\n```go\nfunc (el *Element) Tap() error\n```\nTap will scroll to the button and tap it just like a human. Before the action, it will try to scroll to the element and wait until it's interactable and enabled.\n\n```go\nfunc (el *Element) Text() (string, error)\n```\nText that the element displays.\n\n```go\nfunc (el *Element) Timeout(d time.Duration) *Element\n```\nTimeout returns a clone with the specified total timeout of all chained sub-operations.\n\n```go\nfunc (el *Element) Type(keys ...input.Key) error\n```\nType is similar with Keyboard.Type. Before the action, it will try to scroll to the element and focus on it.\n\n```go\nfunc (el *Element) Visible() (bool, error)\n```\nVisible returns true if the element is visible on the page.\n\n```go\nfunc (el *Element) Wait(opts *EvalOptions) error\n```\nWait until the js returns true.\n\n```go\nfunc (el *Element) WaitEnabled() error\n```\nWaitEnabled until the element is not disabled. Doc for readonly: [https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly)\n\n```go\nfunc (el *Element) WaitInteractable() (pt *proto.Point, err error)\n```\nWaitInteractable waits for the element to be interactable. It will try to scroll to the element on each try.\n\n```go\nfunc (el *Element) WaitInvisible() error\n```\nWaitInvisible until the element invisible.\n\n```go\nfunc (el *Element) WaitLoad() error\n```\nWaitLoad for element like \\\u003cimg\u003e.\n\n```go\nfunc (el *Element) WaitStable(d time.Duration) error\n```\nWaitStable waits until no shape or position change for d duration. Be careful, d is not the max wait timeout, it's the least stable time. If you want to set a timeout you can use the [Element.Timeout](#Element.Timeout) function.\n\n```go\nfunc (el *Element) WaitStableRAF() error\n```\nWaitStableRAF waits until no shape or position change for 2 consecutive animation frames. If you want to wait animation that is triggered by JS not CSS, you'd better use [Element.WaitStable](#Element.WaitStable). About animation frame: [https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame)\n\n```go\nfunc (el *Element) WaitVisible() error\n```\nWaitVisible until the element is visible.\n\n```go\nfunc (el *Element) WaitWritable() error\n```\nWaitWritable until the element is not readonly. Doc for disabled: [https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled)\n\n```go\nfunc (el *Element) WithCancel() (*Element, func())\n```\nWithCancel returns a clone with a context cancel function.\n\n```go\nfunc (el *Element) WithPanic(fail func(interface{})) *Element\n```\nWithPanic returns an element clone with the specified panic function. The fail must stop the current goroutine's execution immediately, such as use [runtime.Goexit](/runtime#Goexit) or panic inside it.\n\n```go\ntype ElementNotFoundError struct{}\n```\nElementNotFoundError error.\n\n```go\nfunc (e *ElementNotFoundError) Error() string\n```\n\n```go\ntype Elements []*Element\n```\nElements provides some helpers to deal with element list.\n\n```go\nfunc (els Elements) Empty() bool\n```\nEmpty returns true if the list is empty.\n\n```go\nfunc (els Elements) First() *Element\n```\nFirst returns the first element, if the list is empty returns nil.\n\n```go\nfunc (els Elements) Last() *Element\n```\nLast returns the last element, if the list is empty returns nil.\n\n```go\ntype EvalError struct {\n\t*proto.RuntimeExceptionDetails\n}\n```\nEvalError error.\n\n```go\nfunc (e *EvalError) Error() string\n```\n\n```go\nfunc (e *EvalError) Is(err error) bool\n```\nIs interface.\n\n```go\ntype EvalOptions struct {\n\t// If enabled the eval result will be a plain JSON value.\n\t// If disabled the eval result will be a reference of a remote js object.\n\tByValue bool\n\n\tAwaitPromise bool\n\n\t// ThisObj represents the \"this\" object in the JS\n\tThisObj *proto.RuntimeRemoteObject\n\n\t// JS function definition to execute.\n\tJS string\n\n\t// JSArgs represents the arguments that will be passed to JS.\n\t// If an argument is [*proto.RuntimeRemoteObject] type, the corresponding remote object will be used.\n\t// Or it will be passed as a plain JSON value.\n\t// When an arg in the args is a *js.Function, the arg will be cached on the page's js context.\n\t// When the arg.Name exists in the page's cache, it reuse the cache without sending\n\t// the definition to the browser again.\n\t// Useful when you need to eval a huge js expression many times.\n\tJSArgs []interface{}\n\n\t// Whether execution should be treated as initiated by user in the UI.\n\tUserGesture bool\n}\n```\nEvalOptions for Page.Evaluate.\n\n```go\nfunc Eval(js string, args ...interface{}) *EvalOptions\n```\nEval creates a [EvalOptions](#EvalOptions) with ByValue set to true.\n\n```go\nfunc (e *EvalOptions) ByObject() *EvalOptions\n```\nByObject disables ByValue.\n\n```go\nfunc (e *EvalOptions) ByPromise() *EvalOptions\n```\nByPromise enables AwaitPromise.\n\n```go\nfunc (e *EvalOptions) ByUser() *EvalOptions\n```\nByUser enables UserGesture.\n\n```go\nfunc (e *EvalOptions) String() string\n```\nString interface.\n\n```go\nfunc (e *EvalOptions) This(obj *proto.RuntimeRemoteObject) *EvalOptions\n```\nThis set the obj as ThisObj.\n\n```go\ntype ExpectElementError struct {\n\t*proto.RuntimeRemoteObject\n}\n```\nExpectElementError error.\n\n```go\nfunc (e *ExpectElementError) Error() string\n```\n\n```go\nfunc (e *ExpectElementError) Is(err error) bool\n```\nIs interface.\n\n```go\ntype ExpectElementsError struct {\n\t*proto.RuntimeRemoteObject\n}\n```\nExpectElementsError error.\n\n```go\nfunc (e *ExpectElementsError) Error() string\n```\n\n```go\nfunc (e *ExpectElementsError) Is(err error) bool\n```\nIs interface.\n\n```go\ntype Hijack struct {\n\tRequest  *HijackRequest\n\tResponse *HijackResponse\n\tOnError  func(error)\n\n\t// Skip to next handler\n\tSkip bool\n\n\t// CustomState is used to store things for this context\n\tCustomState interface{}\n\t// contains filtered or unexported fields\n}\n```\nHijack context.\n\n```go\nfunc (h *Hijack) ContinueRequest(cq *proto.FetchContinueRequest)\n```\nContinueRequest without hijacking. The RequestID will be set by the router, you don't have to set it.\n\n```go\nfunc (h *Hijack) LoadResponse(client *http.Client, loadBody bool) error\n```\nLoadResponse will send request to the real destination and load the response as default response to override.\n\n```go\nfunc (h *Hijack) MustLoadResponse()\n```\nMustLoadResponse is similar to [Hijack.LoadResponse](#Hijack.LoadResponse).\n\n```go\ntype HijackRequest struct {\n\t// contains filtered or unexported fields\n}\n```\nHijackRequest context.\n\n```go\nfunc (ctx *HijackRequest) Body() string\n```\nBody of the request, devtools API doesn't support binary data yet, only string can be captured.\n\n```go\nfunc (ctx *HijackRequest) Header(key string) string\n```\nHeader via a key.\n\n```go\nfunc (ctx *HijackRequest) Headers() proto.NetworkHeaders\n```\nHeaders of request.\n\n```go\nfunc (ctx *HijackRequest) IsNavigation() bool\n```\nIsNavigation determines whether the request is a navigation request.\n\n```go\nfunc (ctx *HijackRequest) JSONBody() gson.JSON\n```\nJSONBody of the request.\n\n```go\nfunc (ctx *HijackRequest) Method() string\n```\nMethod of the request.\n\n```go\nfunc (ctx *HijackRequest) Req() *http.Request\n```\nReq returns the underlying http.Request instance that will be used to send the request.\n\n```go\nfunc (ctx *HijackRequest) SetBody(obj interface{}) *HijackRequest\n```\nSetBody of the request, if obj is \\[]byte or string, raw body will be used, else it will be encoded as json.\n\n```go\nfunc (ctx *HijackRequest) SetContext(c context.Context) *HijackRequest\n```\nSetContext of the underlying http.Request instance.\n\n```go\nfunc (ctx *HijackRequest) Type() proto.NetworkResourceType\n```\nType of the resource.\n\n```go\nfunc (ctx *HijackRequest) URL() *url.URL\n```\nURL of the request.\n\n```go\ntype HijackResponse struct {\n\tRawResponse *http.Response\n\t// contains filtered or unexported fields\n}\n```\nHijackResponse context.\n\n```go\nfunc (ctx *HijackResponse) AddHeader(pairs ...string) *HijackResponse\n```\nAddHeader appends key-value pairs to the end of the response headers. Duplicate keys will be preserved.\n\n```go\nfunc (ctx *HijackResponse) Body() string\n```\nBody of the payload.\n\n```go\nfunc (ctx *HijackResponse) Fail(reason proto.NetworkErrorReason) *HijackResponse\n```\nFail request.\n\n```go\nfunc (ctx *HijackResponse) Headers() http.Header\n```\nHeaders returns the clone of response headers. If you want to modify the response headers use HijackResponse.SetHeader .\n\n```go\nfunc (ctx *HijackResponse) Payload() *proto.FetchFulfillRequest\n```\nPayload to respond the request from the browser.\n\n```go\nfunc (ctx *HijackResponse) SetBody(obj interface{}) *HijackResponse\n```\nSetBody of the payload, if obj is \\[]byte or string, raw body will be used, else it will be encoded as json.\n\n```go\nfunc (ctx *HijackResponse) SetHeader(pairs ...string) *HijackResponse\n```\nSetHeader of the payload via key-value pairs.\n\n```go\ntype HijackRouter struct {\n\t// contains filtered or unexported fields\n}\n```\nHijackRouter context.\n\n```go\nfunc (r *HijackRouter) Add(pattern string, resourceType proto.NetworkResourceType, handler func(*Hijack)) error\n```\nAdd a hijack handler to router, the doc of the pattern is the same as \"proto.FetchRequestPattern.URLPattern\".\n\n```go\nfunc (r *HijackRouter) MustAdd(pattern string, handler func(*Hijack)) *HijackRouter\n```\nMustAdd is similar to [HijackRouter.Add](#HijackRouter.Add).\n\n```go\nfunc (r *HijackRouter) MustRemove(pattern string) *HijackRouter\n```\nMustRemove is similar to [HijackRouter.Remove](#HijackRouter.Remove).\n\n```go\nfunc (r *HijackRouter) MustStop()\n```\nMustStop is similar to [HijackRouter.Stop](#HijackRouter.Stop).\n\n```go\nfunc (r *HijackRouter) Remove(pattern string) error\n```\nRemove handler via the pattern.\n\n```go\nfunc (r *HijackRouter) Run()\n```\nRun the router, after you call it, you shouldn't add new handler to it.\n\n```go\nfunc (r *HijackRouter) Stop() error\n```\nStop the router.\n\n```go\ntype InvisibleShapeError struct {\n\t*Element\n}\n```\nInvisibleShapeError error.\n\n```go\nfunc (e *InvisibleShapeError) Error() string\n```\nError ...\n\n```go\nfunc (e *InvisibleShapeError) Is(err error) bool\n```\nIs interface.\n\n```go\nfunc (e *InvisibleShapeError) Unwrap() error\n```\nUnwrap ...\n\n```go\ntype KeyAction struct {\n\tType KeyActionType\n\tKey  input.Key\n}\n```\nKeyAction to perform.\n\n```go\ntype KeyActionType int\n```\nKeyActionType enum.\n\n```go\nconst (\n\tKeyActionPress KeyActionType = iota\n\tKeyActionRelease\n\tKeyActionTypeKey\n)\n```\nKeyActionTypes.\n\n```go\ntype KeyActions struct {\n\tActions []KeyAction\n\t// contains filtered or unexported fields\n}\n```\nKeyActions to simulate.\n\n```go\nfunc (ka *KeyActions) Do() (err error)\n```\nDo the actions.\n\n```go\nfunc (ka *KeyActions) MustDo()\n```\nMustDo is similar to [KeyActions.Do](#KeyActions.Do).\n\n```go\nfunc (ka *KeyActions) Press(keys ...input.Key) *KeyActions\n```\nPress keys is guaranteed to have a release at the end of actions.\n\n```go\nfunc (ka *KeyActions) Release(keys ...input.Key) *KeyActions\n```\nRelease keys.\n\n```go\nfunc (ka *KeyActions) Type(keys ...input.Key) *KeyActions\n```\nType will release the key immediately after the pressing.\n\n```go\ntype Keyboard struct {\n\tsync.Mutex\n\t// contains filtered or unexported fields\n}\n```\nKeyboard represents the keyboard on a page, it's always related the main frame.\n\n```go\nfunc (k *Keyboard) MustType(key ...input.Key) *Keyboard\n```\nMustType is similar to [Keyboard.Type](#Keyboard.Type).\n\n```go\nfunc (k *Keyboard) Press(key input.Key) error\n```\nPress the key down. To input characters that are not on the keyboard, such as Chinese or Japanese, you should use method like [Page.InsertText](#Page.InsertText).\n\n```go\nfunc (k *Keyboard) Release(key input.Key) error\n```\nRelease the key.\n\n```go\nfunc (k *Keyboard) Type(keys ...input.Key) (err error)\n```\nType releases the key after the press.\n\n```go\ntype Message struct {\n\tSessionID proto.TargetSessionID\n\tMethod    string\n\t// contains filtered or unexported fields\n}\n```\nMessage represents a cdp.Event.\n\n```go\nfunc (msg *Message) Load(e proto.Event) bool\n```\nLoad data into e, returns true if e matches the event type.\n\n```go\ntype Mouse struct {\n\tsync.Mutex\n\t// contains filtered or unexported fields\n}\n```\nMouse represents the mouse on a page, it's always related the main frame.\n\n```go\nfunc (m *Mouse) Click(button proto.InputMouseButton, clickCount int) error\n```\nClick the button. It's the combination of [Mouse.Down](#Mouse.Down) and [Mouse.Up](#Mouse.Up).\n\n```go\nfunc (m *Mouse) Down(button proto.InputMouseButton, clickCount int) error\n```\nDown holds the button down.\n\n```go\nfunc (m *Mouse) MoveAlong(guide func() (proto.Point, bool)) error\n```\nMoveAlong the guide function. Every time the guide function is called it should return the next mouse position, return true to stop. Read the source code of [Mouse.MoveLinear](#Mouse.MoveLinear) as an example to use this method.\n\n```go\nfunc (m *Mouse) MoveLinear(to proto.Point, steps int) error\n```\nMoveLinear to the absolute position with the given steps. Such as move from (0,0) to (6,6) with 3 steps, the mouse will first move to (2,2) then (4,4) then (6,6).\n\n```go\nfunc (m *Mouse) MoveTo(p proto.Point) error\n```\nMoveTo the absolute position.\n\n```go\nfunc (m *Mouse) MustClick(button proto.InputMouseButton) *Mouse\n```\nMustClick is similar to [Mouse.Click](#Mouse.Click).\n\n```go\nfunc (m *Mouse) MustDown(button proto.InputMouseButton) *Mouse\n```\nMustDown is similar to [Mouse.Down](#Mouse.Down).\n\n```go\nfunc (m *Mouse) MustMoveTo(x, y float64) *Mouse\n```\nMustMoveTo is similar to \\[Mouse.Move].\n\n```go\nfunc (m *Mouse) MustScroll(x, y float64) *Mouse\n```\nMustScroll is similar to [Mouse.Scroll](#Mouse.Scroll).\n\n```go\nfunc (m *Mouse) MustUp(button proto.InputMouseButton) *Mouse\n```\nMustUp is similar to [Mouse.Up](#Mouse.Up).\n\n```go\nfunc (m *Mouse) Position() proto.Point\n```\nPosition of current cursor.\n\n```go\nfunc (m *Mouse) Scroll(offsetX, offsetY float64, steps int) error\n```\nScroll the relative offset with specified steps.\n\n```go\nfunc (m *Mouse) Up(button proto.InputMouseButton, clickCount int) error\n```\nUp releases the button.\n\n```go\ntype NavigationError struct {\n\tReason string\n}\n```\nNavigationError error.\n\n```go\nfunc (e *NavigationError) Error() string\n```\n\n```go\nfunc (e *NavigationError) Is(err error) bool\n```\nIs interface.\n\n```go\ntype NoPointerEventsError struct {\n\t*Element\n}\n```\nNoPointerEventsError error.\n\n```go\nfunc (e *NoPointerEventsError) Error() string\n```\nError ...\n\n```go\nfunc (e *NoPointerEventsError) Is(err error) bool\n```\nIs interface.\n\n```go\nfunc (e *NoPointerEventsError) Unwrap() error\n```\nUnwrap ...\n\n```go\ntype NoShadowRootError struct {\n\t*Element\n}\n```\nNoShadowRootError error.\n\n```go\nfunc (e *NoShadowRootError) Error() string\n```\nError ...\n\n```go\nfunc (e *NoShadowRootError) Is(err error) bool\n```\nIs interface.\n\n```go\ntype NotInteractableError struct{}\n```\nNotInteractableError error. Check the doc of Element.Interactable for details.\n\n```go\nfunc (e *NotInteractableError) Error() string\n```\n\n```go\ntype ObjectNotFoundError struct {\n\t*proto.RuntimeRemoteObject\n}\n```\nObjectNotFoundError error.\n\n```go\nfunc (e *ObjectNotFoundError) Error() string\n```\n\n```go\nfunc (e *ObjectNotFoundError) Is(err error) bool\n```\nIs interface.\n\n```go\ntype Page struct {\n\t// TargetID is a unique ID for a remote page.\n\t// It's usually used in events sent from the browser to tell which page an event belongs to.\n\tTargetID proto.TargetTargetID\n\n\t// FrameID is a unique ID for a browsing context.\n\t// Usually, different FrameID means different javascript execution context.\n\t// Such as an iframe and the page it belongs to will have the same TargetID but different FrameIDs.\n\tFrameID proto.PageFrameID\n\n\t// SessionID is a unique ID for a page attachment to a controller.\n\t// It's usually used in transport layer to tell which page to send the control signal.\n\t// A page can attached to multiple controllers, the browser uses it distinguish controllers.\n\tSessionID proto.TargetSessionID\n\n\t// devices\n\tMouse    *Mouse\n\tKeyboard *Keyboard\n\tTouch    *Touch\n\t// contains filtered or unexported fields\n}\n```\nPage represents the webpage. We try to hold as less states as possible. When a page is closed by Rod or not all the ongoing operations an events on it will abort.\n\n```go\nfunc (p *Page) Activate() (*Page, error)\n```\nActivate (focuses) the page.\n\n```go\nfunc (p *Page) AddScriptTag(url, content string) error\n```\nAddScriptTag to page. If url is empty, content will be used.\n\n```go\nfunc (p *Page) AddStyleTag(url, content string) error\n```\nAddStyleTag to page. If url is empty, content will be used.\n\n```go\nfunc (p *Page) Browser() *Browser\n```\nBrowser of the page.\n\n```go\nfunc (p *Page) Call(ctx context.Context, sessionID, methodName string, params interface{}) (res []byte, err error)\n```\nCall implements the [proto.Client](/github.com/GoCodeAlone/rod/lib/proto#Client).\n\n```go\nfunc (p *Page) CancelTimeout() *Page\n```\nCancelTimeout cancels the current timeout context and returns a clone with the parent context.\n\n```go\nfunc (p *Page) CaptureDOMSnapshot() (domSnapshot *proto.DOMSnapshotCaptureSnapshotResult, err error)\n```\nCaptureDOMSnapshot Returns a document snapshot, including the full DOM tree of the root node (including iframes, template contents, and imported documents) in a flattened array, as well as layout and white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is flattened. \\`Documents\\` The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document. \\`Strings\\` Shared string table that all string properties refer to with indexes. Normally use \\`Strings\\` is enough.\n\n```go\nfunc (p *Page) Close() error\n```\nClose tries to close page, running its beforeunload hooks, if has any.\n\n```go\nfunc (p *Page) Context(ctx context.Context) *Page\n```\nContext returns a clone with the specified ctx for chained sub-operations.\n\n```go\nfunc (p *Page) Cookies(urls []string) ([]*proto.NetworkCookie, error)\n```\nCookies returns the page cookies. By default it will return the cookies for current page. The urls is the list of URLs for which applicable cookies will be fetched.\n\n```go\nfunc (p *Page) DisableDomain(method proto.Request) (restore func())\n```\nDisableDomain and returns a restore function to restore previous state.\n\n```go\nfunc (p *Page) EachEvent(callbacks ...interface{}) (wait func())\n```\nEachEvent of the specified event types, if any callback returns true the wait function will resolve, The type of each callback is (? means optional):\n\n\tfunc(proto.Event, proto.TargetSessionID?) bool?\n\nYou can listen to multiple event types at the same time like:\n\n\tbrowser.EachEvent(func(a *proto.A) {}, func(b *proto.B) {})\n\nSuch as subscribe the events to know when the navigation is complete or when the page is rendered. Here's an example to dismiss all dialogs/alerts on the page:\n\n\tgo page.EachEvent(func(e *proto.PageJavascriptDialogOpening) {\n\t    _ = proto.PageHandleJavaScriptDialog{ Accept: false, PromptText: \"\"}.Call(page)\n\t})()\n\n```go\nfunc (p *Page) Element(selector string) (*Element, error)\n```\nElement retries until an element in the page that matches the CSS selector, then returns the matched element.\n\n```go\nfunc (p *Page) ElementByJS(opts *EvalOptions) (*Element, error)\n```\nElementByJS returns the element from the return value of the js function. If sleeper is nil, no retry will be performed. By default, it will retry until the js function doesn't return null. To customize the retry logic, check the examples of Page.Sleeper.\n\n```go\nfunc (p *Page) ElementFromNode(node *proto.DOMNode) (*Element, error)\n```\nElementFromNode creates an Element from the node, [proto.DOMNodeID](/github.com/GoCodeAlone/rod/lib/proto#DOMNodeID) or [proto.DOMBackendNodeID](/github.com/GoCodeAlone/rod/lib/proto#DOMBackendNodeID) must be specified.\n\n```go\nfunc (p *Page) ElementFromObject(obj *proto.RuntimeRemoteObject) (*Element, error)\n```\nElementFromObject creates an Element from the remote object id.\n\n```go\nfunc (p *Page) ElementFromPoint(x, y int) (*Element, error)\n```\nElementFromPoint creates an Element from the absolute point on the page. The point should include the window scroll offset.\n\n```go\nfunc (p *Page) ElementR(selector, jsRegex string) (*Element, error)\n```\nElementR retries until an element in the page that matches the css selector and it's text matches the jsRegex, then returns the matched element.\n\n```go\nfunc (p *Page) ElementX(xPath string) (*Element, error)\n```\nElementX retries until an element in the page that matches one of the XPath selectors, then returns the matched element.\n\n```go\nfunc (p *Page) Elements(selector string) (Elements, error)\n```\nElements returns all elements that match the css selector.\n\n```go\nfunc (p *Page) ElementsByJS(opts *EvalOptions) (Elements, error)\n```\nElementsByJS returns the elements from the return value of the js.\n\n```go\nfunc (p *Page) ElementsX(xpath string) (Elements, error)\n```\nElementsX returns all elements that match the XPath selector.\n\n```go\nfunc (p *Page) Emulate(device devices.Device) error\n```\nEmulate the device, such as iPhone9. If device is devices.Clear, it will clear the override.\n\n```go\nfunc (p *Page) EnableDomain(method proto.Request) (restore func())\n```\nEnableDomain and returns a restore function to restore previous state.\n\n```go\nfunc (p *Page) Eval(js string, args ...interface{}) (*proto.RuntimeRemoteObject, error)\n```\nEval is a shortcut for [Page.Evaluate](#Page.Evaluate) with AwaitPromise, ByValue set to true.\n\n```go\nfunc (p *Page) EvalOnNewDocument(js string) (remove func() error, err error)\n```\nEvalOnNewDocument Evaluates given script in every frame upon creation (before loading frame's scripts).\n\n```go\nfunc (p *Page) Evaluate(opts *EvalOptions) (res *proto.RuntimeRemoteObject, err error)\n```\nEvaluate js on the page.\n\n```go\nfunc (p *Page) Event() \u003c-chan *Message\n```\nEvent of the page.\n\n```go\nfunc (p *Page) Expose(name string, fn func(gson.JSON) (interface{}, error)) (stop func() error, err error)\n```\nExpose fn to the page's window object with the name. The exposure survives reloads. Call stop to unbind the fn.\n\n```go\nfunc (p *Page) ExposeHelpers(list ...*js.Function)\n```\nExposeHelpers helper functions to page's js context so that we can use the Devtools' console to debug them.\n\n```go\nfunc (p *Page) GetContext() context.Context\n```\nGetContext of current instance.\n\n```go\nfunc (p *Page) GetNavigationHistory() (*proto.PageGetNavigationHistoryResult, error)\n```\nGetNavigationHistory get navigation history.\n\n```go\nfunc (p *Page) GetResource(url string) ([]byte, error)\n```\nGetResource content by the url. Such as image, css, html, etc. Use the [proto.PageGetResourceTree](/github.com/GoCodeAlone/rod/lib/proto#PageGetResourceTree) to list all the resources.\n\n```go\nfunc (p *Page) GetSessionID() proto.TargetSessionID\n```\nGetSessionID interface.\n\n```go\nfunc (p *Page) GetWindow() (*proto.BrowserBounds, error)\n```\nGetWindow position and size info.\n\n```go\nfunc (p *Page) HTML() (string, error)\n```\nHTML of the page.\n\n```go\nfunc (p *Page) HandleDialog() (\n\twait func() *proto.PageJavascriptDialogOpening,\n\thandle func(*proto.PageHandleJavaScriptDialog) error,\n)\n```\nHandleDialog accepts or dismisses next JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload). Because modal dialog will block js, usually you have to trigger the dialog in another goroutine. For example:\n\n\twait, handle := page.MustHandleDialog()\n\tgo page.MustElement(\"button\").MustClick()\n\twait()\n\thandle(true, \"\")\n\n```go\nfunc (p *Page) HandleFileDialog() (func([]string) error, error)\n```\nHandleFileDialog return a functions that waits for the next file chooser dialog pops up and returns the element for the event.\n\n```go\nfunc (p *Page) Has(selector string) (bool, *Element, error)\n```\nHas an element that matches the css selector.\n\n```go\nfunc (p *Page) HasR(selector, jsRegex string) (bool, *Element, error)\n```\nHasR an element that matches the css selector and its display text matches the jsRegex.\n\n```go\nfunc (p *Page) HasX(selector string) (bool, *Element, error)\n```\nHasX an element that matches the XPath selector.\n\n```go\nfunc (p *Page) HijackRequests() *HijackRouter\n```\nHijackRequests creates a new router instance for requests hijacking. When use Fetch domain outside the router should be stopped. Enabling hijacking disables page caching, but such as 304 Not Modified will still work as expected. The entire process of hijacking one request:\n\n\tbrowser --req-\u003e rod ---\u003e server ---\u003e rod --res-\u003e browser\n\nThe --req-\u003e and --res-\u003e are the parts that can be modified.\n\n```go\nfunc (p *Page) Info() (*proto.TargetTargetInfo, error)\n```\nInfo of the page, such as the URL or title of the page.\n\n```go\nfunc (p *Page) InsertText(text string) error\n```\nInsertText is like pasting text into the page.\n\n```go\nfunc (p *Page) IsIframe() bool\n```\nIsIframe tells if it's iframe.\n\n```go\nfunc (p *Page) KeyActions() *KeyActions\n```\nKeyActions simulates the type actions on a physical keyboard. Useful when input shortcuts like ctrl+enter .\n\n```go\nfunc (p *Page) LoadState(method proto.Request) (has bool)\n```\nLoadState into the method.\n\n```go\nfunc (p *Page) MustActivate() *Page\n```\nMustActivate is similar to [Page.Activate](#Page.Activate).\n\n```go\nfunc (p *Page) MustAddScriptTag(url string) *Page\n```\nMustAddScriptTag is similar to [Page.AddScriptTag](#Page.AddScriptTag).\n\n```go\nfunc (p *Page) MustAddStyleTag(url string) *Page\n```\nMustAddStyleTag is similar to [Page.AddStyleTag](#Page.AddStyleTag).\n\n```go\nfunc (p *Page) MustCaptureDOMSnapshot() (domSnapshot *proto.DOMSnapshotCaptureSnapshotResult)\n```\nMustCaptureDOMSnapshot is similar to [Page.CaptureDOMSnapshot](#Page.CaptureDOMSnapshot).\n\n```go\nfunc (p *Page) MustClose()\n```\nMustClose is similar to [Page.Close](#Page.Close).\n\n```go\nfunc (p *Page) MustCookies(urls ...string) []*proto.NetworkCookie\n```\nMustCookies is similar to [Page.Cookies](#Page.Cookies).\n\n```go\nfunc (p *Page) MustElement(selector string) *Element\n```\nMustElement is similar to [Page.Element](#Page.Element).\n\n```go\nfunc (p *Page) MustElementByJS(js string, params ...interface{}) *Element\n```\nMustElementByJS is similar to [Page.ElementByJS](#Page.ElementByJS).\n\n```go\nfunc (p *Page) MustElementFromNode(node *proto.DOMNode) *Element\n```\nMustElementFromNode is similar to [Page.ElementFromNode](#Page.ElementFromNode).\n\n```go\nfunc (p *Page) MustElementFromPoint(left, top int) *Element\n```\nMustElementFromPoint is similar to [Page.ElementFromPoint](#Page.ElementFromPoint).\n\n```go\nfunc (p *Page) MustElementR(selector, jsRegex string) *Element\n```\nMustElementR is similar to [Page.ElementR](#Page.ElementR).\n\n```go\nfunc (p *Page) MustElementX(xPath string) *Element\n```\nMustElementX is similar to [Page.ElementX](#Page.ElementX).\n\n```go\nfunc (p *Page) MustElements(selector string) Elements\n```\nMustElements is similar to [Page.Elements](#Page.Elements).\n\n```go\nfunc (p *Page) MustElementsByJS(js string, params ...interface{}) Elements\n```\nMustElementsByJS is similar to [Page.ElementsByJS](#Page.ElementsByJS).\n\n```go\nfunc (p *Page) MustElementsX(xpath string) Elements\n```\nMustElementsX is similar to [Page.ElementsX](#Page.ElementsX).\n\n```go\nfunc (p *Page) MustEmulate(device devices.Device) *Page\n```\nMustEmulate is similar to [Page.Emulate](#Page.Emulate).\n\n```go\nfunc (p *Page) MustEval(js string, params ...interface{}) gson.JSON\n```\nMustEval is similar to [Page.Eval](#Page.Eval).\n\n```go\nfunc (p *Page) MustEvalOnNewDocument(js string)\n```\nMustEvalOnNewDocument is similar to [Page.EvalOnNewDocument](#Page.EvalOnNewDocument).\n\n```go\nfunc (p *Page) MustEvaluate(opts *EvalOptions) *proto.RuntimeRemoteObject\n```\nMustEvaluate is similar to [Page.Evaluate](#Page.Evaluate).\n\n```go\nfunc (p *Page) MustExpose(name string, fn func(gson.JSON) (interface{}, error)) (stop func())\n```\nMustExpose is similar to [Page.Expose](#Page.Expose).\n\n```go\nfunc (p *Page) MustGetWindow() *proto.BrowserBounds\n```\nMustGetWindow is similar to [Page.GetWindow](#Page.GetWindow).\n\n```go\nfunc (p *Page) MustHTML() string\n```\nMustHTML is similar to [Page.HTML](#Page.HTML).\n\n```go\nfunc (p *Page) MustHandleDialog() (wait func() *proto.PageJavascriptDialogOpening, handle func(bool, string))\n```\nMustHandleDialog is similar to [Page.HandleDialog](#Page.HandleDialog).\n\n```go\nfunc (p *Page) MustHandleFileDialog() func(...string)\n```\nMustHandleFileDialog is similar to [Page.HandleFileDialog](#Page.HandleFileDialog).\n\n```go\nfunc (p *Page) MustHas(selector string) bool\n```\nMustHas is similar to [Page.Has](#Page.Has).\n\n```go\nfunc (p *Page) MustHasR(selector, regex string) bool\n```\nMustHasR is similar to [Page.HasR](#Page.HasR).\n\n```go\nfunc (p *Page) MustHasX(selector string) bool\n```\nMustHasX is similar to [Page.HasX](#Page.HasX).\n\n```go\nfunc (p *Page) MustInfo() *proto.TargetTargetInfo\n```\nMustInfo is similar to [Page.Info](#Page.Info).\n\n```go\nfunc (p *Page) MustInsertText(text string) *Page\n```\nMustInsertText is similar to [Page.InsertText](#Page.InsertText).\n\n```go\nfunc (p *Page) MustNavigate(url string) *Page\n```\nMustNavigate is similar to [Page.Navigate](#Page.Navigate).\n\n```go\nfunc (p *Page) MustNavigateBack() *Page\n```\nMustNavigateBack is similar to [Page.NavigateBack](#Page.NavigateBack).\n\n```go\nfunc (p *Page) MustNavigateForward() *Page\n```\nMustNavigateForward is similar to [Page.NavigateForward](#Page.NavigateForward).\n\n```go\nfunc (p *Page) MustObjectToJSON(obj *proto.RuntimeRemoteObject) gson.JSON\n```\nMustObjectToJSON is similar to [Page.ObjectToJSON](#Page.ObjectToJSON).\n\n```go\nfunc (p *Page) MustObjectsToJSON(list []*proto.RuntimeRemoteObject) gson.JSON\n```\nMustObjectsToJSON is similar to \\[Page.ObjectsToJSON].\n\n```go\nfunc (p *Page) MustPDF(toFile ...string) []byte\n```\nMustPDF is similar to [Page.PDF](#Page.PDF). If the toFile is \"\", it Page.will save output to \"tmp/pdf\" folder, time as the file name.\n\n```go\nfunc (p *Page) MustRelease(obj *proto.RuntimeRemoteObject) *Page\n```\nMustRelease is similar to [Page.Release](#Page.Release).\n\n```go\nfunc (p *Page) MustReload() *Page\n```\nMustReload is similar to [Page.Reload](#Page.Reload).\n\n```go\nfunc (p *Page) MustResetNavigationHistory() *Page\n```\nMustResetNavigationHistory is similar to [Page.ResetNavigationHistory](#Page.ResetNavigationHistory).\n\n```go\nfunc (p *Page) MustScreenshot(toFile ...string) []byte\n```\nMustScreenshot is similar to [Page.Screenshot](#Page.Screenshot). If the toFile is \"\", it Page.will save output to \"tmp/screenshots\" folder, time as the file name.\n\n```go\nfunc (p *Page) MustScreenshotFullPage(toFile ...string) []byte\n```\nMustScreenshotFullPage is similar to \\[Page.ScreenshotFullPage]. If the toFile is \"\", it Page.will save output to \"tmp/screenshots\" folder, time as the file name.\n\n```go\nfunc (p *Page) MustScrollScreenshot(toFile ...string) []byte\n```\nMustScrollScreenshot is similar to [Page.ScrollScreenshot](#Page.ScrollScreenshot). If the toFile is \"\", it Page.will save output to \"tmp/screenshots\" folder, time as the file name.\n\n```go\nfunc (p *Page) MustSearch(query string) *Element\n```\nMustSearch is similar to [Page.Search](#Page.Search). It only returns the first element in the search result.\n\n```go\nfunc (p *Page) MustSetBlockedURLs(urls ...string) *Page\n```\nMustSetBlockedURLs is similar to [Page.SetBlockedURLs](#Page.SetBlockedURLs).\n\n```go\nfunc (p *Page) MustSetCookies(cookies ...*proto.NetworkCookieParam) *Page\n```\nMustSetCookies is similar to [Page.SetCookies](#Page.SetCookies). If the len(cookies) is 0 it will clear all the cookies.\n\n```go\nfunc (p *Page) MustSetDocumentContent(html string) *Page\n```\nMustSetDocumentContent is similar to [Page.SetDocumentContent](#Page.SetDocumentContent).\n\n```go\nfunc (p *Page) MustSetExtraHeaders(dict ...string) (cleanup func())\n```\nMustSetExtraHeaders is similar to [Page.SetExtraHeaders](#Page.SetExtraHeaders).\n\n```go\nfunc (p *Page) MustSetUserAgent(req *proto.NetworkSetUserAgentOverride) *Page\n```\nMustSetUserAgent is similar to [Page.SetUserAgent](#Page.SetUserAgent).\n\n```go\nfunc (p *Page) MustSetViewport(width, height int, deviceScaleFactor float64, mobile bool) *Page\n```\nMustSetViewport is similar to [Page.SetViewport](#Page.SetViewport).\n\n```go\nfunc (p *Page) MustSetWindow(left, top, width, height int) *Page\n```\nMustSetWindow is similar to [Page.SetWindow](#Page.SetWindow).\n\n```go\nfunc (p *Page) MustStopLoading() *Page\n```\nMustStopLoading is similar to [Page.StopLoading](#Page.StopLoading).\n\n```go\nfunc (p *Page) MustTriggerFavicon() *Page\n```\nMustTriggerFavicon is similar to \\[PageTriggerFavicon].\n\n```go\nfunc (p *Page) MustWait(js string, params ...interface{}) *Page\n```\nMustWait is similar to [Page.Wait](#Page.Wait).\n\n```go\nfunc (p *Page) MustWaitDOMStable() *Page\n```\nMustWaitDOMStable is similar to [Page.WaitDOMStable](#Page.WaitDOMStable).\n\n```go\nfunc (p *Page) MustWaitElementsMoreThan(selector string, num int) *Page\n```\nMustWaitElementsMoreThan is similar to [Page.WaitElementsMoreThan](#Page.WaitElementsMoreThan).\n\n```go\nfunc (p *Page) MustWaitIdle() *Page\n```\nMustWaitIdle is similar to [Page.WaitIdle](#Page.WaitIdle).\n\n```go\nfunc (p *Page) MustWaitLoad() *Page\n```\nMustWaitLoad is similar to [Page.WaitLoad](#Page.WaitLoad).\n\n```go\nfunc (p *Page) MustWaitNavigation() func()\n```\nMustWaitNavigation is similar to [Page.WaitNavigation](#Page.WaitNavigation).\n\n```go\nfunc (p *Page) MustWaitOpen() (wait func() (newPage *Page))\n```\nMustWaitOpen is similar to [Page.WaitOpen](#Page.WaitOpen).\n\n```go\nfunc (p *Page) MustWaitRequestIdle(excludes ...string) (wait func())\n```\nMustWaitRequestIdle is similar to [Page.WaitRequestIdle](#Page.WaitRequestIdle).\n\n```go\nfunc (p *Page) MustWaitStable() *Page\n```\nMustWaitStable is similar to [Page.WaitStable](#Page.WaitStable).\n\n```go\nfunc (p *Page) MustWindowFullscreen() *Page\n```\nMustWindowFullscreen is similar to \\[Page.WindowFullscreen].\n\n```go\nfunc (p *Page) MustWindowMaximize() *Page\n```\nMustWindowMaximize is similar to \\[Page.WindowMaximize].\n\n```go\nfunc (p *Page) MustWindowMinimize() *Page\n```\nMustWindowMinimize is similar to \\[Page.WindowMinimize].\n\n```go\nfunc (p *Page) MustWindowNormal() *Page\n```\nMustWindowNormal is similar to \\[Page.WindowNormal].\n\n```go\nfunc (p *Page) Navigate(url string) error\n```\nNavigate to the url. If the url is empty, \"about:blank\" will be used. It will return immediately after the server responds the http header.\n\n```go\nfunc (p *Page) NavigateBack() error\n```\nNavigateBack history.\n\n```go\nfunc (p *Page) NavigateForward() error\n```\nNavigateForward history.\n\n```go\nfunc (p *Page) ObjectToJSON(obj *proto.RuntimeRemoteObject) (gson.JSON, error)\n```\nObjectToJSON by object id.\n\n```go\nfunc (p *Page) Overlay(left, top, width, height float64, msg string) (remove func())\n```\nOverlay a rectangle on the main frame with specified message.\n\n```go\nfunc (p *Page) PDF(req *proto.PagePrintToPDF) (*StreamReader, error)\n```\nPDF prints page as PDF.\n\n```go\nfunc (p *Page) Race() *RaceContext\n```\nRace creates a context to race selectors.\n\n```go\nfunc (p *Page) Release(obj *proto.RuntimeRemoteObject) error\n```\nRelease the remote object. Usually, you don't need to call it. When a page is closed or reloaded, all remote objects will be released automatically. It's useful if the page never closes or reloads.\n\n```go\nfunc (p *Page) Reload() error\n```\nReload page.\n\n```go\nfunc (p *Page) ResetNavigationHistory() error\n```\nResetNavigationHistory reset history.\n\n```go\nfunc (p *Page) Screenshot(fullPage bool, req *proto.PageCaptureScreenshot) ([]byte, error)\n```\nScreenshot captures the screenshot of current page.\n\n```go\nfunc (p *Page) ScrollScreenshot(opt *ScrollScreenshotOptions) ([]byte, error)\n```\nScrollScreenshot Scroll screenshot does not adjust the size of the viewport, but achieves it by scrolling and capturing screenshots in a loop, and then stitching them together. Note that this method also has a flaw: when there are elements with fixed positioning on the page (usually header navigation components), these elements will appear repeatedly, you can set the FixedTop parameter to optimize it.\n\nOnly support png and jpeg format yet, webP is not supported because no suitable processing library was found in golang.\n\n```go\nfunc (p *Page) Search(query string) (*SearchResult, error)\n```\nSearch for the given query in the DOM tree until the result count is not zero, before that it will keep retrying. The query can be plain text or css selector or xpath. It will search nested iframes and shadow doms too.\n\n```go\nfunc (p *Page) SetBlockedURLs(urls []string) error\n```\nSetBlockedURLs For some requests that do not want to be triggered, such as some dangerous operations, delete, quit logout, etc. Wildcards ('\\*') are allowed, such as \\[\"\\*/api/logout/\\*\",\"delete\"]. NOTE: if you set empty pattern \"\", it will block all requests.\n\n```go\nfunc (p *Page) SetCookies(cookies []*proto.NetworkCookieParam) error\n```\nSetCookies is similar to Browser.SetCookies .\n\n```go\nfunc (p *Page) SetDocumentContent(html string) error\n```\nSetDocumentContent sets the page document html content.\n\n```go\nfunc (p *Page) SetExtraHeaders(dict []string) (func(), error)\n```\nSetExtraHeaders whether to always send extra HTTP headers with the requests from this page.\n\n```go\nfunc (p *Page) SetUserAgent(req *proto.NetworkSetUserAgentOverride) error\n```\nSetUserAgent (browser brand, accept-language, etc) of the page. If req is nil, a default user agent will be used, a typical mac chrome.\n\n```go\nfunc (p *Page) SetViewport(params *proto.EmulationSetDeviceMetricsOverride) error\n```\nSetViewport overrides the values of device screen dimensions.\n\n```go\nfunc (p *Page) SetWindow(bounds *proto.BrowserBounds) error\n```\nSetWindow location and size.\n\n```go\nfunc (p *Page) Sleeper(sleeper func() utils.Sleeper) *Page\n```\nSleeper returns a clone with the specified sleeper for chained sub-operations.\n\n```go\nfunc (p *Page) StopLoading() error\n```\nStopLoading forces the page stop navigation and pending resource fetches.\n\n```go\nfunc (p *Page) String() string\n```\nString interface.\n\n```go\nfunc (p *Page) Timeout(d time.Duration) *Page\n```\nTimeout returns a clone with the specified total timeout of all chained sub-operations.\n\n```go\nfunc (p *Page) TriggerFavicon() error\n```\nTriggerFavicon supports when browser in headless mode to trigger favicon's request. Pay attention to this function only supported when browser in headless mode, if you call it in no-headless mode, it will raise an error with the message \"browser is no-headless\".\n\n```go\nfunc (p *Page) Wait(opts *EvalOptions) error\n```\nWait until the js returns true.\n\n```go\nfunc (p *Page) WaitDOMStable(d time.Duration, diff float64) error\n```\nWaitDOMStable waits until the change of the DOM tree is less or equal than diff percent for d duration. Be careful, d is not the max wait timeout, it's the least stable time. If you want to set a timeout you can use the [Page.Timeout](#Page.Timeout) function.\n\n```go\nfunc (p *Page) WaitElementsMoreThan(selector string, num int) error\n```\nWaitElementsMoreThan waits until there are more than num elements that match the selector.\n\n```go\nfunc (p *Page) WaitEvent(e proto.Event) (wait func())\n```\nWaitEvent waits for the next event for one time. It will also load the data into the event object.\n\n```go\nfunc (p *Page) WaitIdle(timeout time.Duration) (err error)\n```\nWaitIdle waits until the next window.requestIdleCallback is called.\n\n```go\nfunc (p *Page) WaitLoad() error\n```\nWaitLoad waits for the \\`window.onload\\` event, it returns immediately if the event is already fired.\n\n```go\nfunc (p *Page) WaitNavigation(name proto.PageLifecycleEventName) func()\n```\nWaitNavigation wait for a page lifecycle event when navigating. Usually you will wait for [proto.PageLifecycleEventNameNetworkAlmostIdle](/github.com/GoCodeAlone/rod/lib/proto#PageLifecycleEventNameNetworkAlmostIdle).\n\n```go\nfunc (p *Page) WaitOpen() func() (*Page, error)\n```\nWaitOpen waits for the next new page opened by the current one.\n\n```go\nfunc (p *Page) WaitRepaint() error\n```\nWaitRepaint waits until the next repaint. Doc: [https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame)\n\n```go\nfunc (p *Page) WaitRequestIdle(\n\td time.Duration,\n\tincludes, excludes []string,\n\texcludeTypes []proto.NetworkResourceType,\n) func()\n```\nWaitRequestIdle returns a wait function that waits until no request for d duration. Be careful, d is not the max wait timeout, it's the least idle time. If you want to set a timeout you can use the [Page.Timeout](#Page.Timeout) function. Use the includes and excludes regexp list to filter the requests by their url.\n\n```go\nfunc (p *Page) WaitStable(d time.Duration) error\n```\nWaitStable waits until the page is stable for d duration.\n\n```go\nfunc (p *Page) WithCancel() (*Page, func())\n```\nWithCancel returns a clone with a context cancel function.\n\n```go\nfunc (p *Page) WithPanic(fail func(interface{})) *Page\n```\nWithPanic returns a page clone with the specified panic function. The fail must stop the current goroutine's execution immediately, such as use [runtime.Goexit](/runtime#Goexit) or panic inside it.\n\n```go\ntype PageCloseCanceledError struct{}\n```\nPageCloseCanceledError error.\n\n```go\nfunc (e *PageCloseCanceledError) Error() string\n```\n\n```go\ntype PageNotFoundError struct{}\n```\nPageNotFoundError error.\n\n```go\nfunc (e *PageNotFoundError) Error() string\n```\n\n```go\ntype Pages []*Page\n```\nPages provides some helpers to deal with page list.\n\n```go\nfunc (ps Pages) Empty() bool\n```\nEmpty returns true if the list is empty.\n\n```go\nfunc (ps Pages) Find(selector string) (*Page, error)\n```\nFind the page that has the specified element with the css selector.\n\n```go\nfunc (ps Pages) FindByURL(jsRegex string) (*Page, error)\n```\nFindByURL returns the page that has the url that matches the jsRegex.\n\n```go\nfunc (ps Pages) First() *Page\n```\nFirst returns the first page, if the list is empty returns nil.\n\n```go\nfunc (ps Pages) Last() *Page\n```\nLast returns the last page, if the list is empty returns nil.\n\n```go\nfunc (ps Pages) MustFind(selector string) *Page\n```\nMustFind is similar to \\[Browser.Find].\n\n```go\nfunc (ps Pages) MustFindByURL(regex string) *Page\n```\nMustFindByURL is similar to \\[Page.FindByURL].\n\n```go\ntype Pool[T any] chan *T\n```\nPool is used to thread-safely limit the number of elements at the same time. It's a common practice to use a channel to limit concurrency, it's not special for rod. This helper is more like an example to use Go Channel. Reference: [https://golang.org/doc/effective\\_go#channels](https://golang.org/doc/effective_go#channels)\n\n```go\nfunc NewBrowserPool(limit int) Pool[Browser]\n```\nNewBrowserPool instance.\n\n```go\nfunc NewPagePool(limit int) Pool[Page]\n```\nNewPagePool instance.\n\n```go\nfunc NewPool[T any](limit int) Pool[T]\n```\nNewPool instance.\n\n```go\nfunc (p Pool[T]) Cleanup(iteratee func(*T))\n```\nCleanup helper.\n\n```go\nfunc (p Pool[T]) Get(create func() (*T, error)) (elem *T, err error)\n```\nGet a elem from the pool, allow error. Use the \\[Pool\\[T].Put] to make it reusable later.\n\n```go\nfunc (p Pool[T]) MustGet(create func() *T) *T\n```\nMustGet an elem from the pool. Use the \\[Pool\\[T].Put] to make it reusable later.\n\n```go\nfunc (p Pool[T]) Put(elem *T)\n```\nPut an elem back to the pool.\n\n```go\ntype RaceContext struct {\n\t// contains filtered or unexported fields\n}\n```\nRaceContext stores the branches to race.\n\n```go\nfunc (rc *RaceContext) Do() (*Element, error)\n```\nDo the race.\n\n```go\nfunc (rc *RaceContext) Element(selector string) *RaceContext\n```\nElement is similar to [Page.Element](#Page.Element).\n\n```go\nfunc (rc *RaceContext) ElementByJS(opts *EvalOptions) *RaceContext\n```\nElementByJS is similar to [Page.ElementByJS](#Page.ElementByJS).\n\n```go\nfunc (rc *RaceContext) ElementFunc(fn func(*Page) (*Element, error)) *RaceContext\n```\nElementFunc takes a custom function to determine race success.\n\n```go\nfunc (rc *RaceContext) ElementR(selector, regex string) *RaceContext\n```\nElementR is similar to [Page.ElementR](#Page.ElementR).\n\n```go\nfunc (rc *RaceContext) ElementX(selector string) *RaceContext\n```\nElementX is similar to [Page.ElementX](#Page.ElementX).\n\n```go\nfunc (rc *RaceContext) Handle(callback func(*Element) error) *RaceContext\n```\nHandle adds a callback function to the most recent chained selector. The callback function is run, if the corresponding selector is present first, in the Race condition.\n\n```go\nfunc (rc *RaceContext) MustDo() *Element\n```\nMustDo is similar to [RaceContext.Do](#RaceContext.Do).\n\n```go\nfunc (rc *RaceContext) MustElementByJS(js string, params []interface{}) *RaceContext\n```\nMustElementByJS is similar to [RaceContext.ElementByJS](#RaceContext.ElementByJS).\n\n```go\nfunc (rc *RaceContext) MustHandle(callback func(*Element)) *RaceContext\n```\nMustHandle is similar to [RaceContext.Handle](#RaceContext.Handle).\n\n```go\nfunc (rc *RaceContext) Search(query string) *RaceContext\n```\nSearch is similar to [Page.Search](#Page.Search).\n\n```go\ntype ScrollScreenshotOptions struct {\n\t// Format (optional) Image compression format (defaults to png).\n\tFormat proto.PageCaptureScreenshotFormat `json:\"format,omitempty\"`\n\n\t// Quality (optional) Compression quality from range [0..100] (jpeg only).\n\tQuality *int `json:\"quality,omitempty\"`\n\n\t// FixedTop (optional) The number of pixels to skip from the top.\n\t// It is suitable for optimizing the screenshot effect when there is a fixed\n\t// positioning element at the top of the page.\n\tFixedTop float64\n\n\t// FixedBottom (optional) The number of pixels to skip from the bottom.\n\tFixedBottom float64\n\n\t// WaitPerScroll until no animation (default is 300ms)\n\tWaitPerScroll time.Duration\n}\n```\nScrollScreenshotOptions is the options for the ScrollScreenshot.\n\n```go\ntype SearchResult struct {\n\t*proto.DOMPerformSearchResult\n\n\t// First element in the search result\n\tFirst *Element\n\t// contains filtered or unexported fields\n}\n```\nSearchResult handler.\n\n```go\nfunc (s *SearchResult) All() (Elements, error)\n```\nAll returns all elements.\n\n```go\nfunc (s *SearchResult) Get(i, l int) (Elements, error)\n```\nGet l elements at the index of i from the remote search result.\n\n```go\nfunc (s *SearchResult) Release()\n```\nRelease the remote search result.\n\n```go\ntype SelectorType string\n```\nSelectorType enum.\n\n```go\nconst (\n\t// SelectorTypeRegex type.\n\tSelectorTypeRegex SelectorType = \"regex\"\n\t// SelectorTypeCSSSector type.\n\tSelectorTypeCSSSector SelectorType = \"css-selector\"\n\t// SelectorTypeText type.\n\tSelectorTypeText SelectorType = \"text\"\n)\n```\n\n```go\ntype StreamReader struct {\n\tOffset *int\n\t// contains filtered or unexported fields\n}\n```\nStreamReader for browser data stream.\n\n```go\nfunc NewStreamReader(c proto.Client, h proto.IOStreamHandle) *StreamReader\n```\nNewStreamReader instance.\n\n```go\nfunc (sr *StreamReader) Close() error\n```\nClose the stream, discard any temporary backing storage.\n\n```go\nfunc (sr *StreamReader) Read(p []byte) (n int, err error)\n```\n\n```go\ntype Touch struct {\n\t// contains filtered or unexported fields\n}\n```\nTouch presents a touch device, such as a hand with fingers, each finger is a [proto.InputTouchPoint](/github.com/GoCodeAlone/rod/lib/proto#InputTouchPoint). Touch events is stateless, we use the struct here only as a namespace to make the API style unified.\n\n```go\nfunc (t *Touch) Cancel() error\n```\nCancel touch action.\n\n```go\nfunc (t *Touch) End() error\n```\nEnd touch action.\n\n```go\nfunc (t *Touch) Move(points ...*proto.InputTouchPoint) error\n```\nMove touch points. Use the [proto.InputTouchPoint.ID](/github.com/GoCodeAlone/rod/lib/proto#InputTouchPoint.ID) (Touch.identifier) to track points. Doc: [https://developer.mozilla.org/en-US/docs/Web/API/Touch\\_events](https://developer.mozilla.org/en-US/docs/Web/API/Touch_events)\n\n```go\nfunc (t *Touch) MustCancel() *Touch\n```\nMustCancel is similar to [Touch.Cancel](#Touch.Cancel).\n\n```go\nfunc (t *Touch) MustEnd() *Touch\n```\nMustEnd is similar to [Touch.End](#Touch.End).\n\n```go\nfunc (t *Touch) MustMove(points ...*proto.InputTouchPoint) *Touch\n```\nMustMove is similar to [Touch.Move](#Touch.Move).\n\n```go\nfunc (t *Touch) MustStart(points ...*proto.InputTouchPoint) *Touch\n```\nMustStart is similar to [Touch.Start](#Touch.Start).\n\n```go\nfunc (t *Touch) MustTap(x, y float64) *Touch\n```\nMustTap is similar to [Touch.Tap](#Touch.Tap).\n\n```go\nfunc (t *Touch) Start(points ...*proto.InputTouchPoint) error\n```\nStart a touch action.\n\n```go\nfunc (t *Touch) Tap(x, y float64) error\n```\nTap dispatches a touchstart and touchend event.\n\n```go\ntype TraceType string\n```\nTraceType for logger.\n\n```go\nconst (\n\t// TraceTypeWaitRequestsIdle type.\n\tTraceTypeWaitRequestsIdle TraceType = \"wait requests idle\"\n\n\t// TraceTypeWaitRequests type.\n\tTraceTypeWaitRequests TraceType = \"wait requests\"\n\n\t// TraceTypeQuery type.\n\tTraceTypeQuery TraceType = \"query\"\n\n\t// TraceTypeWait type.\n\tTraceTypeWait TraceType = \"wait\"\n\n\t// TraceTypeInput type.\n\tTraceTypeInput TraceType = \"input\"\n)\n```\n\n```go\nfunc (t TraceType) String() string\n```\nString interface.\n\n```go\ntype TryError struct {\n\tValue interface{}\n\tStack string\n}\n```\nTryError error.\n\n```go\nfunc (e *TryError) Error() string\n```\n\n```go\nfunc (e *TryError) Is(err error) bool\n```\nIs interface.\n\n```go\nfunc (e *TryError) Unwrap() error\n```\nUnwrap stdlib interface.\n\n","path":"github.com/GoCodeAlone/rod","name":"rod","synopsis":"Package rod is a high-level driver directly based on DevTools Protocol.","isRedistributable":true}
