playwright

package module
v0.1400.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: MIT Imports: 28 Imported by: 0

README

🎭 Playwright for

Feedback for future development of this project is needed, see here. Thanks!

PkgGoDev License Go Report Card Build Status Join Slack Coverage Status Chromium version Firefox version WebKit version

API reference | Example recipes

Playwright is a Go library to automate Chromium, Firefox and WebKit with a single API. Playwright is built to enable cross-browser web automation that is ever-green, capable, reliable and fast.

Linux macOS Windows
Chromium 94.0.4595.0
WebKit 15.0
Firefox 91.0

Headless execution is supported for all the browsers on all platforms.

Installation

go get github.com/mxschmitt/playwright-go

Capabilities

Playwright is built to automate the broad and growing set of web browser capabilities used by Single Page Apps and Progressive Web Apps.

  • Scenarios that span multiple page, domains and iframes
  • Auto-wait for elements to be ready before executing actions (like click, fill)
  • Intercept network activity for stubbing and mocking network requests
  • Emulate mobile devices, geolocation, permissions
  • Support for web components via shadow-piercing selectors
  • Native input events for mouse and keyboard
  • Upload and download files

Example

The following example crawls the current top voted items from Hacker News.

package main

import (
	"fmt"
	"log"

	"github.com/mxschmitt/playwright-go"
)

func main() {
	pw, err := playwright.Run()
	if err != nil {
		log.Fatalf("could not start playwright: %v", err)
	}
	browser, err := pw.Chromium.Launch()
	if err != nil {
		log.Fatalf("could not launch browser: %v", err)
	}
	page, err := browser.NewPage()
	if err != nil {
		log.Fatalf("could not create page: %v", err)
	}
	if _, err = page.Goto("https://news.ycombinator.com"); err != nil {
		log.Fatalf("could not goto: %v", err)
	}
	entries, err := page.QuerySelectorAll(".athing")
	if err != nil {
		log.Fatalf("could not get entries: %v", err)
	}
	for i, entry := range entries {
		titleElement, err := entry.QuerySelector("td.title > a")
		if err != nil {
			log.Fatalf("could not get title element: %v", err)
		}
		title, err := titleElement.TextContent()
		if err != nil {
			log.Fatalf("could not get text content: %v", err)
		}
		fmt.Printf("%d: %s\n", i+1, title)
	}
	if err = browser.Close(); err != nil {
		log.Fatalf("could not close browser: %v", err)
	}
	if err = pw.Stop(); err != nil {
		log.Fatalf("could not stop Playwright: %v", err)
	}
}

More examples

How does it work?

Playwright is a Node.js library which uses:

  • Chrome DevTools Protocol to communicate with Chromium
  • Patched Firefox to communicate with Firefox
  • Patched WebKit to communicate with WebKit

These patches are based on the original sources of the browsers and don't modify the browser behaviour so the browsers are basically the same (see here) as you see them in the wild. The support for different programming languages is based on exposing a RPC server in the Node.js land which can be used to allow other languages to use Playwright without implementing all the custom logic:

The bridge between Node.js and the other languages is basically a Node.js runtime combined with Playwright which gets shipped for each of these languages (around 50MB) and then communicates over stdio to send the relevant commands. This will also download the pre-compiled browsers.

Is Playwright for Go ready?

We are ready for your feedback, but we are still covering Playwright Go with the tests.

Resources

Documentation

Overview

Package playwright is a library to automate Chromium, Firefox and WebKit with a single API. Playwright is built to enable cross-browser web automation that is ever-green, capable, reliable and fast.

Index

Constants

This section is empty.

Variables

View Source
var (
	MixedStateOn    *MixedState = getMixedState("On")
	MixedStateOff               = getMixedState("Off")
	MixedStateMixed             = getMixedState("Mixed")
)
View Source
var (
	ColorSchemeLight        *ColorScheme = getColorScheme("light")
	ColorSchemeDark                      = getColorScheme("dark")
	ColorSchemeNoPreference              = getColorScheme("no-preference")
)
View Source
var (
	MouseButtonLeft   *MouseButton = getMouseButton("left")
	MouseButtonRight               = getMouseButton("right")
	MouseButtonMiddle              = getMouseButton("middle")
)
View Source
var (
	KeyboardModifierAlt     *KeyboardModifier = getKeyboardModifier("Alt")
	KeyboardModifierControl                   = getKeyboardModifier("Control")
	KeyboardModifierMeta                      = getKeyboardModifier("Meta")
	KeyboardModifierShift                     = getKeyboardModifier("Shift")
)
View Source
var (
	ElementStateVisible  *ElementState = getElementState("visible")
	ElementStateHidden                 = getElementState("hidden")
	ElementStateStable                 = getElementState("stable")
	ElementStateEnabled                = getElementState("enabled")
	ElementStateDisabled               = getElementState("disabled")
	ElementStateEditable               = getElementState("editable")
)
View Source
var (
	WaitForSelectorStateAttached *WaitForSelectorState = getWaitForSelectorState("attached")
	WaitForSelectorStateDetached                       = getWaitForSelectorState("detached")
	WaitForSelectorStateVisible                        = getWaitForSelectorState("visible")
	WaitForSelectorStateHidden                         = getWaitForSelectorState("hidden")
)
View Source
var (
	WaitUntilStateLoad             *WaitUntilState = getWaitUntilState("load")
	WaitUntilStateDomcontentloaded                 = getWaitUntilState("domcontentloaded")
	WaitUntilStateNetworkidle                      = getWaitUntilState("networkidle")
)
View Source
var (
	LoadStateLoad             *LoadState = getLoadState("load")
	LoadStateDomcontentloaded            = getLoadState("domcontentloaded")
	LoadStateNetworkidle                 = getLoadState("networkidle")
)
View Source
var (
	MediaScreen *Media = getMedia("screen")
	MediaPrint         = getMedia("print")
	MediaNull          = getMedia("null")
)
View Source
var (
	SameSiteAttributeStrict *SameSiteAttribute = getSameSiteAttribute("Strict")
	SameSiteAttributeLax                       = getSameSiteAttribute("Lax")
	SameSiteAttributeNone                      = getSameSiteAttribute("None")
)

Functions

func Bool

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func Float

func Float(v float64) *float64

Float is a helper routine that allocates a new float64 value to store v and returns a pointer to it.

func Install

func Install(options ...*RunOptions) error

Install does download the driver and the browsers. If not called manually before playwright.Run() it will get executed there and might take a few seconds to download the Playwright suite.

func Int

func Int(v int) *int

Int is a helper routine that allocates a new int32 value to store v and returns a pointer to it.

func IntSlice added in v0.1100.0

func IntSlice(v ...int) *[]int

IntSlice is a helper routine that allocates a new IntSlice value to store v and returns a pointer to it.

func Null

func Null() interface{}

Null will be used in certain scenarios where a strict nil pointer check is not possible

func String

func String(v string) *string

String is a helper routine that allocates a new string value to store v and returns a pointer to it.

func StringSlice added in v0.1100.0

func StringSlice(v ...string) *[]string

StringSlice is a helper routine that allocates a new StringSlice value to store v and returns a pointer to it.

Types

type BindingCall

type BindingCall interface {
	Call(f BindingCallFunction)
}

type BindingCallFunction added in v0.171.1

type BindingCallFunction = func(source *BindingSource, args ...interface{}) interface{}

BindingCallFunction represents the func signature of an exposed binding call func

type BindingSource added in v0.171.1

type BindingSource struct {
	Context BrowserContext
	Page    Page
	Frame   Frame
}

BindingSource is the value passed to a binding call execution

type Browser

type Browser interface {
	EventEmitter
	// In case this browser is obtained using BrowserType.launch(), closes the browser and all of its pages (if any
	// were opened).
	// In case this browser is connected to, clears all created contexts belonging to this browser and disconnects from the
	// browser server.
	// The `Browser` object itself is considered to be disposed and cannot be used anymore.
	Close() error
	// Returns an array of all open browser contexts. In a newly created browser, this will return zero browser contexts.
	Contexts() []BrowserContext
	// Indicates that the browser is connected.
	IsConnected() bool
	// Creates a new browser context. It won't share cookies/cache with other browser contexts.
	NewContext(options ...BrowserNewContextOptions) (BrowserContext, error)
	// Creates a new page in a new browser context. Closing this page will close the context as well.
	// This is a convenience API that should only be used for the single-page scenarios and short snippets. Production code and
	// testing frameworks should explicitly create Browser.newContext() followed by the
	// BrowserContext.newPage() to control their exact life times.
	NewPage(options ...BrowserNewContextOptions) (Page, error)
	// > NOTE: CDP Sessions are only supported on Chromium-based browsers.
	// Returns the newly created browser session.
	NewBrowserCDPSession() (CDPSession, error)
	// Returns the browser version.
	Version() string
}

A Browser is created via BrowserType.launch(). An example of using a `Browser` to create a `Page`:

type BrowserContext

type BrowserContext interface {
	EventEmitter
	// Adds cookies into this browser context. All pages within this context will have these cookies installed. Cookies can be
	// obtained via BrowserContext.cookies().
	AddCookies(cookies ...SetNetworkCookieParam) error
	// Adds a script which would be evaluated in one of the following scenarios:
	// - Whenever a page is created in the browser context or is navigated.
	// - Whenever a child frame is attached or navigated in any page in the browser context. In this case, the script is
	// evaluated in the context of the newly attached frame.
	// The script is evaluated after the document was created but before any of its scripts were run. This is useful to amend
	// the JavaScript environment, e.g. to seed `Math.random`.
	// An example of overriding `Math.random` before the page loads:
	// > NOTE: The order of evaluation of multiple scripts installed via BrowserContext.addInitScript() and
	// Page.addInitScript() is not defined.
	AddInitScript(script BrowserContextAddInitScriptOptions) error
	// Returns the browser instance of the context. If it was launched as a persistent context null gets returned.
	Browser() Browser
	// Clears context cookies.
	ClearCookies() error
	// Clears all permission overrides for the browser context.
	ClearPermissions() error
	// Closes the browser context. All the pages that belong to the browser context will be closed.
	// > NOTE: The default browser context cannot be closed.
	Close() error
	// If no URLs are specified, this method returns all cookies. If URLs are specified, only cookies that affect those URLs
	// are returned.
	Cookies(urls ...string) ([]*NetworkCookie, error)
	ExpectEvent(event string, cb func() error) (interface{}, error)
	// The method adds a function called `name` on the `window` object of every frame in every page in the context. When
	// called, the function executes `callback` and returns a [Promise] which resolves to the return value of `callback`. If
	// the `callback` returns a [Promise], it will be awaited.
	// The first argument of the `callback` function contains information about the caller: `{ browserContext: BrowserContext,
	// page: Page, frame: Frame }`.
	// See Page.exposeBinding() for page-only version.
	// An example of exposing page URL to all frames in all pages in the context:
	// An example of passing an element handle:
	ExposeBinding(name string, binding BindingCallFunction, handle ...bool) error
	// The method adds a function called `name` on the `window` object of every frame in every page in the context. When
	// called, the function executes `callback` and returns a [Promise] which resolves to the return value of `callback`.
	// If the `callback` returns a [Promise], it will be awaited.
	// See Page.exposeFunction() for page-only version.
	// An example of adding a `sha256` function to all pages in the context:
	ExposeFunction(name string, binding ExposedFunction) error
	// Grants specified permissions to the browser context. Only grants corresponding permissions to the given origin if
	// specified.
	GrantPermissions(permissions []string, options ...BrowserContextGrantPermissionsOptions) error
	// > NOTE: CDP sessions are only supported on Chromium-based browsers.
	// Returns the newly created session.
	NewCDPSession(page Page) (CDPSession, error)
	// Creates a new page in the browser context.
	NewPage(options ...BrowserNewPageOptions) (Page, error)
	// Returns all open pages in the context.
	Pages() []Page
	// This setting will change the default maximum navigation time for the following methods and related shortcuts:
	// - Page.goBack()
	// - Page.goForward()
	// - Page.goto()
	// - Page.reload()
	// - Page.setContent()
	// - Page.waitForNavigation()
	// > NOTE: Page.setDefaultNavigationTimeout`] and [`method: Page.setDefaultTimeout() take priority over
	// BrowserContext.setDefaultNavigationTimeout().
	SetDefaultNavigationTimeout(timeout float64)
	// This setting will change the default maximum time for all the methods accepting `timeout` option.
	// > NOTE: Page.setDefaultNavigationTimeout`], [`method: Page.setDefaultTimeout() and
	// BrowserContext.setDefaultNavigationTimeout`] take priority over [`method: BrowserContext.setDefaultTimeout().
	SetDefaultTimeout(timeout float64)
	// The extra HTTP headers will be sent with every request initiated by any page in the context. These headers are merged
	// with page-specific extra HTTP headers set with Page.setExtraHTTPHeaders(). If page overrides a particular
	// header, page-specific header value will be used instead of the browser context header value.
	// > NOTE: BrowserContext.setExtraHTTPHeaders() does not guarantee the order of headers in the outgoing requests.
	SetExtraHTTPHeaders(headers map[string]string) error
	// Sets the context's geolocation. Passing `null` or `undefined` emulates position unavailable.
	// > NOTE: Consider using BrowserContext.grantPermissions() to grant permissions for the browser context pages to
	// read its geolocation.
	SetGeolocation(gelocation *SetGeolocationOptions) error
	ResetGeolocation() error
	// Routing provides the capability to modify network requests that are made by any page in the browser context. Once route
	// is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted.
	// An example of a naive handler that aborts all image requests:
	// or the same snippet using a regex pattern instead:
	// It is possible to examine the request to decide the route action. For example, mocking all requests that contain some
	// post data, and leaving all other requests as is:
	// Page routes (set up with Page.route()) take precedence over browser context routes when request matches both
	// handlers.
	// To remove a route with its handler you can use BrowserContext.unroute().
	// > NOTE: Enabling routing disables http cache.
	Route(url interface{}, handler routeHandler) error
	SetOffline(offline bool) error
	// Returns storage state for this browser context, contains current cookies and local storage snapshot.
	StorageState(path ...string) (*StorageState, error)
	// Removes a route created with BrowserContext.route(). When `handler` is not specified, removes all routes for
	// the `url`.
	Unroute(url interface{}, handler ...routeHandler) error
	// Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy
	// value. Will throw an error if the context closes before the event is fired. Returns the event data value.
	WaitForEvent(event string, predicate ...interface{}) interface{}
	Tracing() Tracing
	// > NOTE: Background pages are only supported on Chromium-based browsers.
	// All existing background pages in the context.
	BackgroundPages() []Page
}

BrowserContexts provide a way to operate multiple independent browser sessions. If a page opens another page, e.g. with a `window.open` call, the popup will belong to the parent page's browser context. Playwright allows creation of "incognito" browser contexts with `browser.newContext()` method. "Incognito" browser contexts don't write any browsing data to disk.

type BrowserContextAddInitScriptOptions

type BrowserContextAddInitScriptOptions struct {
	// Optional Script source to be evaluated in all pages in the browser context.
	Script *string `json:"script"`
	// Optional Script path to be evaluated in all pages in the browser context.
	Path *string `json:"path"`
}

type BrowserContextCookies added in v0.1100.0

type BrowserContextCookies struct {
	Name  *string `json:"name"`
	Value *string `json:"value"`
	// either url or domain / path are required. Optional.
	URL *string `json:"url"`
	// either url or domain / path are required Optional.
	Domain *string `json:"domain"`
	// either url or domain / path are required Optional.
	Path *string `json:"path"`
	// Unix time in seconds. Optional.
	Expires *float64 `json:"expires"`
	// Optional.
	HttpOnly *bool `json:"httpOnly"`
	// Optional.
	Secure *bool `json:"secure"`
	// Optional.
	SameSite *SameSiteAttribute `json:"sameSite"`
}

type BrowserContextCookiesOptions added in v0.1100.0

type BrowserContextCookiesOptions struct {
	// Optional list of URLs.
	Urls []string `json:"urls"`
}

type BrowserContextCookiesResult added in v0.1100.0

type BrowserContextCookiesResult struct {
	Name   *string `json:"name"`
	Value  *string `json:"value"`
	Domain *string `json:"domain"`
	Path   *string `json:"path"`
	// Unix time in seconds.
	Expires  *float64           `json:"expires"`
	HttpOnly *bool              `json:"httpOnly"`
	Secure   *bool              `json:"secure"`
	SameSite *SameSiteAttribute `json:"sameSite"`
}

Result of calling <see cref="BrowserContext.Cookies" />.

type BrowserContextExposeBindingOptions

type BrowserContextExposeBindingOptions struct {
	// Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is supported. When passing by value, multiple arguments are supported.
	Handle *bool `json:"handle"`
}

type BrowserContextGeolocation added in v0.1100.0

type BrowserContextGeolocation struct {
	// Latitude between -90 and 90.
	Latitude *float64 `json:"latitude"`
	// Longitude between -180 and 180.
	Longitude *float64 `json:"longitude"`
	// Non-negative accuracy value. Defaults to `0`.
	Accuracy *float64 `json:"accuracy"`
}

type BrowserContextGrantPermissionsOptions

type BrowserContextGrantPermissionsOptions struct {
	// The [origin] to grant permissions to, e.g. "https://example.com".
	Origin *string `json:"origin"`
}

type BrowserContextRouteOptions added in v0.1100.0

type BrowserContextRouteOptions struct {
	// handler function to route the request.
	Handler func(Route) `json:"handler"`
}

type BrowserContextStorageStateOptions

type BrowserContextStorageStateOptions struct {
	// The file path to save the storage state to. If `path` is a relative path, then it is resolved relative to current working directory. If no path is provided, storage state is still returned, but won't be saved to the disk.
	Path *string `json:"path"`
}

type BrowserContextStorageStateResult added in v0.1100.0

type BrowserContextStorageStateResult struct {
	Cookies []BrowserContextStorageStateResultCookies `json:"cookies"`
	Origins []BrowserContextStorageStateResultOrigins `json:"origins"`
}

Result of calling <see cref="BrowserContext.StorageState" />.

type BrowserContextStorageStateResultCookies added in v0.1100.0

type BrowserContextStorageStateResultCookies struct {
	Name   *string `json:"name"`
	Value  *string `json:"value"`
	Domain *string `json:"domain"`
	Path   *string `json:"path"`
	// Unix time in seconds.
	Expires  *float64           `json:"expires"`
	HttpOnly *bool              `json:"httpOnly"`
	Secure   *bool              `json:"secure"`
	SameSite *SameSiteAttribute `json:"sameSite"`
}

type BrowserContextStorageStateResultOrigins added in v0.1100.0

type BrowserContextStorageStateResultOrigins struct {
	Origin       *string                                               `json:"origin"`
	LocalStorage []BrowserContextStorageStateResultOriginsLocalStorage `json:"localStorage"`
}

type BrowserContextStorageStateResultOriginsLocalStorage added in v0.1100.0

type BrowserContextStorageStateResultOriginsLocalStorage struct {
	Name  *string `json:"name"`
	Value *string `json:"value"`
}

type BrowserContextUnrouteOptions added in v0.1100.0

type BrowserContextUnrouteOptions struct {
	// Optional handler function used to register a routing with BrowserContext.Route().
	Handler func(Route, Request) `json:"handler"`
}

type BrowserGeolocation added in v0.1100.0

type BrowserGeolocation struct {
	// Latitude between -90 and 90.
	Latitude *float64 `json:"latitude"`
	// Longitude between -180 and 180.
	Longitude *float64 `json:"longitude"`
	// Non-negative accuracy value. Defaults to `0`.
	Accuracy *float64 `json:"accuracy"`
}

type BrowserHttpCredentials added in v0.1100.0

type BrowserHttpCredentials struct {
	Username *string `json:"username"`
	Password *string `json:"password"`
}

type BrowserNewContextOptions

type BrowserNewContextOptions struct {
	// Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
	AcceptDownloads *bool `json:"acceptDownloads"`
	// When using Page.Goto(), Page.Route(), Page.WaitForURL(), Page.WaitForRequest(), or Page.WaitForResponse() it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Examples:
	// baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
	// baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
	BaseURL *string `json:"baseURL"`
	// Toggles bypassing page's Content-Security-Policy.
	BypassCSP *bool `json:"bypassCSP"`
	// Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See Page.EmulateMedia() for more details. Defaults to `'light'`.
	ColorScheme *ColorScheme `json:"colorScheme"`
	// Specify device scale factor (can be thought of as dpr). Defaults to `1`.
	DeviceScaleFactor *float64 `json:"deviceScaleFactor"`
	// An object containing additional HTTP headers to be sent with every request. All header values must be strings.
	ExtraHttpHeaders map[string]string                    `json:"extraHTTPHeaders"`
	Geolocation      *BrowserNewContextOptionsGeolocation `json:"geolocation"`
	// Specifies if viewport supports touch events. Defaults to false.
	HasTouch *bool `json:"hasTouch"`
	// Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).
	HttpCredentials *BrowserNewContextOptionsHttpCredentials `json:"httpCredentials"`
	// Whether to ignore HTTPS errors during navigation. Defaults to `false`.
	IgnoreHttpsErrors *bool `json:"ignoreHTTPSErrors"`
	// Whether the `meta viewport` tag is taken into account and touch events are enabled. Defaults to `false`. Not supported in Firefox.
	IsMobile *bool `json:"isMobile"`
	// Whether or not to enable JavaScript in the context. Defaults to `true`.
	JavaScriptEnabled *bool `json:"javaScriptEnabled"`
	// Specify user locale, for example `en-GB`, `de-DE`, etc. Locale will affect `navigator.language` value, `Accept-Language` request header value as well as number and date formatting rules.
	Locale *string `json:"locale"`
	// Whether to emulate network being offline. Defaults to `false`.
	Offline *bool `json:"offline"`
	// A list of permissions to grant to all pages in this context. See BrowserContext.GrantPermissions() for more details.
	Permissions []string `json:"permissions"`
	// Network proxy settings to use with this context.
	// For Chromium on Windows the browser needs to be launched with the global proxy for this option to work. If all contexts override the proxy, global proxy will be never used and can be any string, for example `launch({ proxy: { server: 'http://per-context' } })`.
	Proxy *BrowserNewContextOptionsProxy `json:"proxy"`
	// Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await BrowserContext.Close() for videos to be saved.
	RecordVideo *BrowserNewContextOptionsRecordVideo `json:"recordVideo"`
	// Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. See Page.EmulateMedia() for more details. Defaults to `'no-preference'`.
	ReducedMotion *ReducedMotion `json:"reducedMotion"`
	// Emulates consistent window screen size available inside web page via `window.screen`. Is only used when the `viewport` is set.
	Screen *BrowserNewContextOptionsScreen `json:"screen"`
	// Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via BrowserContext.StorageState(). Either a path to the file with saved storage, or an object with the following fields:
	StorageState *BrowserNewContextOptionsStorageState `json:"storageState"`
	// Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via BrowserContext.StorageState(). Path to the file with saved storage state.
	StorageStatePath *string `json:"storageStatePath"`
	// Changes the timezone of the context. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs.
	TimezoneId *string `json:"timezoneId"`
	// Specific user agent to use in this context.
	UserAgent *string `json:"userAgent"`
	// Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. `no_viewport` disables the fixed viewport.
	Viewport *BrowserNewContextOptionsViewport `json:"viewport"`
}

type BrowserNewContextOptionsGeolocation added in v0.1100.0

type BrowserNewContextOptionsGeolocation struct {
	// Latitude between -90 and 90.
	Latitude *float64 `json:"latitude"`
	// Longitude between -180 and 180.
	Longitude *float64 `json:"longitude"`
	// Non-negative accuracy value. Defaults to `0`.
	Accuracy *float64 `json:"accuracy"`
}

type BrowserNewContextOptionsHttpCredentials added in v0.1100.0

type BrowserNewContextOptionsHttpCredentials struct {
	Username *string `json:"username"`
	Password *string `json:"password"`
}

type BrowserNewContextOptionsProxy added in v0.1100.0

type BrowserNewContextOptionsProxy struct {
	// Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example `http://myproxy.com:3128` or `socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy.
	Server *string `json:"server"`
	// Optional coma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.
	Bypass *string `json:"bypass"`
	// Optional username to use if HTTP proxy requires authentication.
	Username *string `json:"username"`
	// Optional password to use if HTTP proxy requires authentication.
	Password *string `json:"password"`
}

type BrowserNewContextOptionsRecordVideo added in v0.1100.0

type BrowserNewContextOptionsRecordVideo struct {
	// Path to the directory to put videos into.
	Dir *string `json:"dir"`
	// Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will be scaled down if necessary to fit the specified size.
	Size *BrowserNewContextOptionsRecordVideoSize `json:"size"`
}

type BrowserNewContextOptionsRecordVideoSize added in v0.1100.0

type BrowserNewContextOptionsRecordVideoSize struct {
	// Video frame width.
	Width *int `json:"width"`
	// Video frame height.
	Height *int `json:"height"`
}

type BrowserNewContextOptionsScreen added in v0.1400.0

type BrowserNewContextOptionsScreen struct {
	// page width in pixels.
	Width *int `json:"width"`
	// page height in pixels.
	Height *int `json:"height"`
}

type BrowserNewContextOptionsStorageState added in v0.1400.0

type BrowserNewContextOptionsStorageState struct {
	// Optional cookies to set for context
	Cookies []BrowserNewContextOptionsStorageStateCookies `json:"cookies"`
	// Optional localStorage to set for context
	Origins []BrowserNewContextOptionsStorageStateOrigins `json:"origins"`
}

type BrowserNewContextOptionsStorageStateCookies added in v0.1400.0

type BrowserNewContextOptionsStorageStateCookies struct {
	Name  *string `json:"name"`
	Value *string `json:"value"`
	// Optional either url or domain / path are required
	URL *string `json:"url"`
	// Optional either url or domain / path are required
	Domain *string `json:"domain"`
	// Optional either url or domain / path are required
	Path *string `json:"path"`
	// Optional Unix time in seconds.
	Expires *float64 `json:"expires"`
	// Optional httpOnly flag
	HttpOnly *bool `json:"httpOnly"`
	// Optional secure flag
	Secure *bool `json:"secure"`
	// Optional sameSite flag
	SameSite *SameSiteAttribute `json:"sameSite"`
}

type BrowserNewContextOptionsStorageStateOrigins added in v0.1400.0

type BrowserNewContextOptionsStorageStateOrigins struct {
	Origin       *string                                                   `json:"origin"`
	LocalStorage []BrowserNewContextOptionsStorageStateOriginsLocalStorage `json:"localStorage"`
}

type BrowserNewContextOptionsStorageStateOriginsLocalStorage added in v0.1400.0

type BrowserNewContextOptionsStorageStateOriginsLocalStorage struct {
	Name  *string `json:"name"`
	Value *string `json:"value"`
}

type BrowserNewContextOptionsViewport added in v0.1100.0

type BrowserNewContextOptionsViewport struct {
	// page width in pixels.
	Width *int `json:"width"`
	// page height in pixels.
	Height *int `json:"height"`
}

type BrowserNewPageOptions

type BrowserNewPageOptions struct {
	// Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
	AcceptDownloads *bool `json:"acceptDownloads"`
	// When using Page.Goto(), Page.Route(), Page.WaitForURL(), Page.WaitForRequest(), or Page.WaitForResponse() it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Examples:
	// baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
	// baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
	BaseURL *string `json:"baseURL"`
	// Toggles bypassing page's Content-Security-Policy.
	BypassCSP *bool `json:"bypassCSP"`
	// Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See Page.EmulateMedia() for more details. Defaults to `'light'`.
	ColorScheme *ColorScheme `json:"colorScheme"`
	// Specify device scale factor (can be thought of as dpr). Defaults to `1`.
	DeviceScaleFactor *float64 `json:"deviceScaleFactor"`
	// An object containing additional HTTP headers to be sent with every request. All header values must be strings.
	ExtraHttpHeaders map[string]string                 `json:"extraHTTPHeaders"`
	Geolocation      *BrowserNewPageOptionsGeolocation `json:"geolocation"`
	// Specifies if viewport supports touch events. Defaults to false.
	HasTouch *bool `json:"hasTouch"`
	// Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).
	HttpCredentials *BrowserNewPageOptionsHttpCredentials `json:"httpCredentials"`
	// Whether to ignore HTTPS errors during navigation. Defaults to `false`.
	IgnoreHttpsErrors *bool `json:"ignoreHTTPSErrors"`
	// Whether the `meta viewport` tag is taken into account and touch events are enabled. Defaults to `false`. Not supported in Firefox.
	IsMobile *bool `json:"isMobile"`
	// Whether or not to enable JavaScript in the context. Defaults to `true`.
	JavaScriptEnabled *bool `json:"javaScriptEnabled"`
	// Specify user locale, for example `en-GB`, `de-DE`, etc. Locale will affect `navigator.language` value, `Accept-Language` request header value as well as number and date formatting rules.
	Locale *string `json:"locale"`
	// Whether to emulate network being offline. Defaults to `false`.
	Offline *bool `json:"offline"`
	// A list of permissions to grant to all pages in this context. See BrowserContext.GrantPermissions() for more details.
	Permissions []string `json:"permissions"`
	// Network proxy settings to use with this context.
	// For Chromium on Windows the browser needs to be launched with the global proxy for this option to work. If all contexts override the proxy, global proxy will be never used and can be any string, for example `launch({ proxy: { server: 'http://per-context' } })`.
	Proxy *BrowserNewPageOptionsProxy `json:"proxy"`
	// Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await BrowserContext.Close() for videos to be saved.
	RecordVideo *BrowserNewPageOptionsRecordVideo `json:"recordVideo"`
	// Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. See Page.EmulateMedia() for more details. Defaults to `'no-preference'`.
	ReducedMotion *ReducedMotion `json:"reducedMotion"`
	// Emulates consistent window screen size available inside web page via `window.screen`. Is only used when the `viewport` is set.
	Screen *BrowserNewPageOptionsScreen `json:"screen"`
	// Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via BrowserContext.StorageState(). Either a path to the file with saved storage, or an object with the following fields:
	StorageState *BrowserNewPageOptionsStorageState `json:"storageState"`
	// Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via BrowserContext.StorageState(). Path to the file with saved storage state.
	StorageStatePath *string `json:"storageStatePath"`
	// Changes the timezone of the context. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs.
	TimezoneId *string `json:"timezoneId"`
	// Specific user agent to use in this context.
	UserAgent *string `json:"userAgent"`
	// Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. `no_viewport` disables the fixed viewport.
	Viewport *BrowserNewPageOptionsViewport `json:"viewport"`
}

type BrowserNewPageOptionsGeolocation added in v0.1100.0

type BrowserNewPageOptionsGeolocation struct {
	// Latitude between -90 and 90.
	Latitude *float64 `json:"latitude"`
	// Longitude between -180 and 180.
	Longitude *float64 `json:"longitude"`
	// Non-negative accuracy value. Defaults to `0`.
	Accuracy *float64 `json:"accuracy"`
}

type BrowserNewPageOptionsHttpCredentials added in v0.1100.0

type BrowserNewPageOptionsHttpCredentials struct {
	Username *string `json:"username"`
	Password *string `json:"password"`
}

type BrowserNewPageOptionsProxy added in v0.1100.0

type BrowserNewPageOptionsProxy struct {
	// Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example `http://myproxy.com:3128` or `socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy.
	Server *string `json:"server"`
	// Optional coma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.
	Bypass *string `json:"bypass"`
	// Optional username to use if HTTP proxy requires authentication.
	Username *string `json:"username"`
	// Optional password to use if HTTP proxy requires authentication.
	Password *string `json:"password"`
}

type BrowserNewPageOptionsRecordVideo added in v0.1100.0

type BrowserNewPageOptionsRecordVideo struct {
	// Path to the directory to put videos into.
	Dir *string `json:"dir"`
	// Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will be scaled down if necessary to fit the specified size.
	Size *BrowserNewPageOptionsRecordVideoSize `json:"size"`
}

type BrowserNewPageOptionsRecordVideoSize added in v0.1100.0

type BrowserNewPageOptionsRecordVideoSize struct {
	// Video frame width.
	Width *int `json:"width"`
	// Video frame height.
	Height *int `json:"height"`
}

type BrowserNewPageOptionsScreen added in v0.1400.0

type BrowserNewPageOptionsScreen struct {
	// page width in pixels.
	Width *int `json:"width"`
	// page height in pixels.
	Height *int `json:"height"`
}

type BrowserNewPageOptionsStorageState added in v0.1400.0

type BrowserNewPageOptionsStorageState struct {
	// Optional cookies to set for context
	Cookies []BrowserNewPageOptionsStorageStateCookies `json:"cookies"`
	// Optional localStorage to set for context
	Origins []BrowserNewPageOptionsStorageStateOrigins `json:"origins"`
}

type BrowserNewPageOptionsStorageStateCookies added in v0.1400.0

type BrowserNewPageOptionsStorageStateCookies struct {
	Name  *string `json:"name"`
	Value *string `json:"value"`
	// Optional either url or domain / path are required
	URL *string `json:"url"`
	// Optional either url or domain / path are required
	Domain *string `json:"domain"`
	// Optional either url or domain / path are required
	Path *string `json:"path"`
	// Optional Unix time in seconds.
	Expires *float64 `json:"expires"`
	// Optional httpOnly flag
	HttpOnly *bool `json:"httpOnly"`
	// Optional secure flag
	Secure *bool `json:"secure"`
	// Optional sameSite flag
	SameSite *SameSiteAttribute `json:"sameSite"`
}

type BrowserNewPageOptionsStorageStateOrigins added in v0.1400.0

type BrowserNewPageOptionsStorageStateOrigins struct {
	Origin       *string                                                `json:"origin"`
	LocalStorage []BrowserNewPageOptionsStorageStateOriginsLocalStorage `json:"localStorage"`
}

type BrowserNewPageOptionsStorageStateOriginsLocalStorage added in v0.1400.0

type BrowserNewPageOptionsStorageStateOriginsLocalStorage struct {
	Name  *string `json:"name"`
	Value *string `json:"value"`
}

type BrowserNewPageOptionsViewport added in v0.1100.0

type BrowserNewPageOptionsViewport struct {
	// page width in pixels.
	Width *int `json:"width"`
	// page height in pixels.
	Height *int `json:"height"`
}

type BrowserProxy added in v0.1100.0

type BrowserProxy struct {
	// Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example `http://myproxy.com:3128` or `socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy.
	Server *string `json:"server"`
	// Optional coma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.
	Bypass *string `json:"bypass"`
	// Optional username to use if HTTP proxy requires authentication.
	Username *string `json:"username"`
	// Optional password to use if HTTP proxy requires authentication.
	Password *string `json:"password"`
}

type BrowserRecordVideo added in v0.1100.0

type BrowserRecordVideo struct {
	// Path to the directory to put videos into.
	Dir *string `json:"dir"`
	// Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will be scaled down if necessary to fit the specified size.
	Size *BrowserRecordVideoSize `json:"size"`
}

type BrowserRecordVideoSize added in v0.1100.0

type BrowserRecordVideoSize struct {
	// Video frame width.
	Width *int `json:"width"`
	// Video frame height.
	Height *int `json:"height"`
}

type BrowserScreen added in v0.1400.0

type BrowserScreen struct {
	// page width in pixels.
	Width *int `json:"width"`
	// page height in pixels.
	Height *int `json:"height"`
}

type BrowserStorageState added in v0.1400.0

type BrowserStorageState struct {
	// Optional cookies to set for context
	Cookies []BrowserStorageStateCookies `json:"cookies"`
	// Optional localStorage to set for context
	Origins []BrowserStorageStateOrigins `json:"origins"`
}

type BrowserStorageStateCookies added in v0.1400.0

type BrowserStorageStateCookies struct {
	Name  *string `json:"name"`
	Value *string `json:"value"`
	// Optional either url or domain / path are required
	URL *string `json:"url"`
	// Optional either url or domain / path are required
	Domain *string `json:"domain"`
	// Optional either url or domain / path are required
	Path *string `json:"path"`
	// Optional Unix time in seconds.
	Expires *float64 `json:"expires"`
	// Optional httpOnly flag
	HttpOnly *bool `json:"httpOnly"`
	// Optional secure flag
	Secure *bool `json:"secure"`
	// Optional sameSite flag
	SameSite *SameSiteAttribute `json:"sameSite"`
}

type BrowserStorageStateOrigins added in v0.1400.0

type BrowserStorageStateOrigins struct {
	Origin       *string                                  `json:"origin"`
	LocalStorage []BrowserStorageStateOriginsLocalStorage `json:"localStorage"`
}

type BrowserStorageStateOriginsLocalStorage added in v0.1400.0

type BrowserStorageStateOriginsLocalStorage struct {
	Name  *string `json:"name"`
	Value *string `json:"value"`
}

type BrowserType

type BrowserType interface {
	// A path where Playwright expects to find a bundled browser executable.
	ExecutablePath() string
	// Returns the browser instance.
	// You can use `ignoreDefaultArgs` to filter out `--mute-audio` from default arguments:
	// > **Chromium-only** Playwright can also be used to control the Google Chrome or Microsoft Edge browsers, but it works
	// best with the version of Chromium it is bundled with. There is no guarantee it will work with any other version. Use
	// `executablePath` option with extreme caution.
	// >
	// > If Google Chrome (rather than Chromium) is preferred, a
	// [Chrome Canary](https://www.google.com/chrome/browser/canary.html) or
	// [Dev Channel](https://www.chromium.org/getting-involved/dev-channel) build is suggested.
	// >
	// > Stock browsers like Google Chrome and Microsoft Edge are suitable for tests that require proprietary media codecs for
	// video playback. See
	// [this article](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for other
	// differences between Chromium and Chrome.
	// [This article](https://chromium.googlesource.com/chromium/src/+/lkgr/docs/chromium_browser_vs_google_chrome.md)
	// describes some differences for Linux users.
	Launch(options ...BrowserTypeLaunchOptions) (Browser, error)
	// Returns the persistent browser context instance.
	// Launches browser that uses persistent storage located at `userDataDir` and returns the only context. Closing this
	// context will automatically close the browser.
	LaunchPersistentContext(userDataDir string, options ...BrowserTypeLaunchPersistentContextOptions) (BrowserContext, error)
	// Returns browser name. For example: `'chromium'`, `'webkit'` or `'firefox'`.
	Name() string
	// This methods attaches Playwright to an existing browser instance.
	Connect(url string, options ...BrowserTypeConnectOptions) (Browser, error)
}

BrowserType provides methods to launch a specific browser instance or connect to an existing one. The following is a typical example of using Playwright to drive automation:

type BrowserTypeConnectOptions added in v0.1400.0

type BrowserTypeConnectOptions struct {
	// Additional HTTP headers to be sent with web socket connect request. Optional.
	Headers map[string]string `json:"headers"`
	// Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. Defaults to 0.
	SlowMo *float64 `json:"slowMo"`
	// Maximum time in milliseconds to wait for the connection to be established. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.
	Timeout *float64 `json:"timeout"`
}

type BrowserTypeGeolocation added in v0.1100.0

type BrowserTypeGeolocation struct {
	// Latitude between -90 and 90.
	Latitude *float64 `json:"latitude"`
	// Longitude between -180 and 180.
	Longitude *float64 `json:"longitude"`
	// Non-negative accuracy value. Defaults to `0`.
	Accuracy *float64 `json:"accuracy"`
}

type BrowserTypeHttpCredentials added in v0.1100.0

type BrowserTypeHttpCredentials struct {
	Username *string `json:"username"`
	Password *string `json:"password"`
}

type BrowserTypeLaunchOptions

type BrowserTypeLaunchOptions struct {
	// Additional arguments to pass to the browser instance. The list of Chromium flags can be found [here](http://peter.sh/experiments/chromium-command-line-switches/).
	Args []string `json:"args"`
	// Browser distribution channel.  Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge", "msedge-beta", "msedge-dev", "msedge-canary". Read more about using [Google Chrome and Microsoft Edge](./browsers.md#google-chrome--microsoft-edge).
	Channel *string `json:"channel"`
	// Enable Chromium sandboxing. Defaults to `false`.
	ChromiumSandbox *bool `json:"chromiumSandbox"`
	// **Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the `headless` option will be set `false`.
	Devtools *bool `json:"devtools"`
	// If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and is deleted when browser is closed.
	DownloadsPath *string `json:"downloadsPath"`
	// Specify environment variables that will be visible to the browser. Defaults to `process.env`.
	Env map[string]string `json:"env"`
	// Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to the current working directory. Note that Playwright only works with the bundled Chromium, Firefox or WebKit, use at your own risk.
	ExecutablePath *string `json:"executablePath"`
	// Close the browser process on SIGHUP. Defaults to `true`.
	HandleSIGHUP *bool `json:"handleSIGHUP"`
	// Close the browser process on Ctrl-C. Defaults to `true`.
	HandleSIGINT *bool `json:"handleSIGINT"`
	// Close the browser process on SIGTERM. Defaults to `true`.
	HandleSIGTERM *bool `json:"handleSIGTERM"`
	// Whether to run browser in headless mode. More details for [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode). Defaults to `true` unless the `devtools` option is `true`.
	Headless *bool `json:"headless"`
	// Network proxy settings.
	Proxy *BrowserTypeLaunchOptionsProxy `json:"proxy"`
	// Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on.
	SlowMo *float64 `json:"slowMo"`
	// Maximum time in milliseconds to wait for the browser instance to start. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.
	Timeout *float64 `json:"timeout"`
	// If specified, traces are saved into this directory.
	TracesDir *string `json:"tracesDir"`
}

type BrowserTypeLaunchOptionsProxy added in v0.1100.0

type BrowserTypeLaunchOptionsProxy struct {
	// Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example `http://myproxy.com:3128` or `socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy.
	Server *string `json:"server"`
	// Optional coma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.
	Bypass *string `json:"bypass"`
	// Optional username to use if HTTP proxy requires authentication.
	Username *string `json:"username"`
	// Optional password to use if HTTP proxy requires authentication.
	Password *string `json:"password"`
}

type BrowserTypeLaunchPersistentContextOptions

type BrowserTypeLaunchPersistentContextOptions struct {
	// Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
	AcceptDownloads *bool `json:"acceptDownloads"`
	// Additional arguments to pass to the browser instance. The list of Chromium flags can be found [here](http://peter.sh/experiments/chromium-command-line-switches/).
	Args []string `json:"args"`
	// When using Page.Goto(), Page.Route(), Page.WaitForURL(), Page.WaitForRequest(), or Page.WaitForResponse() it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Examples:
	// baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
	// baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
	BaseURL *string `json:"baseURL"`
	// Toggles bypassing page's Content-Security-Policy.
	BypassCSP *bool `json:"bypassCSP"`
	// Browser distribution channel.  Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge", "msedge-beta", "msedge-dev", "msedge-canary". Read more about using [Google Chrome and Microsoft Edge](./browsers.md#google-chrome--microsoft-edge).
	Channel *string `json:"channel"`
	// Enable Chromium sandboxing. Defaults to `false`.
	ChromiumSandbox *bool `json:"chromiumSandbox"`
	// Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See Page.EmulateMedia() for more details. Defaults to `'light'`.
	ColorScheme *ColorScheme `json:"colorScheme"`
	// Specify device scale factor (can be thought of as dpr). Defaults to `1`.
	DeviceScaleFactor *float64 `json:"deviceScaleFactor"`
	// **Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the `headless` option will be set `false`.
	Devtools *bool `json:"devtools"`
	// If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and is deleted when browser is closed.
	DownloadsPath *string `json:"downloadsPath"`
	// Specify environment variables that will be visible to the browser. Defaults to `process.env`.
	Env map[string]string `json:"env"`
	// Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to the current working directory. Note that Playwright only works with the bundled Chromium, Firefox or WebKit, use at your own risk.
	ExecutablePath *string `json:"executablePath"`
	// An object containing additional HTTP headers to be sent with every request. All header values must be strings.
	ExtraHttpHeaders map[string]string                                     `json:"extraHTTPHeaders"`
	Geolocation      *BrowserTypeLaunchPersistentContextOptionsGeolocation `json:"geolocation"`
	// Close the browser process on SIGHUP. Defaults to `true`.
	HandleSIGHUP *bool `json:"handleSIGHUP"`
	// Close the browser process on Ctrl-C. Defaults to `true`.
	HandleSIGINT *bool `json:"handleSIGINT"`
	// Close the browser process on SIGTERM. Defaults to `true`.
	HandleSIGTERM *bool `json:"handleSIGTERM"`
	// Specifies if viewport supports touch events. Defaults to false.
	HasTouch *bool `json:"hasTouch"`
	// Whether to run browser in headless mode. More details for [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode). Defaults to `true` unless the `devtools` option is `true`.
	Headless *bool `json:"headless"`
	// Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).
	HttpCredentials *BrowserTypeLaunchPersistentContextOptionsHttpCredentials `json:"httpCredentials"`
	// Whether to ignore HTTPS errors during navigation. Defaults to `false`.
	IgnoreHttpsErrors *bool `json:"ignoreHTTPSErrors"`
	// Whether the `meta viewport` tag is taken into account and touch events are enabled. Defaults to `false`. Not supported in Firefox.
	IsMobile *bool `json:"isMobile"`
	// Whether or not to enable JavaScript in the context. Defaults to `true`.
	JavaScriptEnabled *bool `json:"javaScriptEnabled"`
	// Specify user locale, for example `en-GB`, `de-DE`, etc. Locale will affect `navigator.language` value, `Accept-Language` request header value as well as number and date formatting rules.
	Locale *string `json:"locale"`
	// Whether to emulate network being offline. Defaults to `false`.
	Offline *bool `json:"offline"`
	// A list of permissions to grant to all pages in this context. See BrowserContext.GrantPermissions() for more details.
	Permissions []string `json:"permissions"`
	// Network proxy settings.
	Proxy *BrowserTypeLaunchPersistentContextOptionsProxy `json:"proxy"`
	// Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await BrowserContext.Close() for videos to be saved.
	RecordVideo *BrowserTypeLaunchPersistentContextOptionsRecordVideo `json:"recordVideo"`
	// Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. See Page.EmulateMedia() for more details. Defaults to `'no-preference'`.
	ReducedMotion *ReducedMotion `json:"reducedMotion"`
	// Emulates consistent window screen size available inside web page via `window.screen`. Is only used when the `viewport` is set.
	Screen *BrowserTypeLaunchPersistentContextOptionsScreen `json:"screen"`
	// Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on.
	SlowMo *float64 `json:"slowMo"`
	// Maximum time in milliseconds to wait for the browser instance to start. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.
	Timeout *float64 `json:"timeout"`
	// Changes the timezone of the context. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs.
	TimezoneId *string `json:"timezoneId"`
	// If specified, traces are saved into this directory.
	TracesDir *string `json:"tracesDir"`
	// Specific user agent to use in this context.
	UserAgent *string `json:"userAgent"`
	// Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. `no_viewport` disables the fixed viewport.
	Viewport *BrowserTypeLaunchPersistentContextOptionsViewport `json:"viewport"`
}

type BrowserTypeLaunchPersistentContextOptionsGeolocation added in v0.1100.0

type BrowserTypeLaunchPersistentContextOptionsGeolocation struct {
	// Latitude between -90 and 90.
	Latitude *float64 `json:"latitude"`
	// Longitude between -180 and 180.
	Longitude *float64 `json:"longitude"`
	// Non-negative accuracy value. Defaults to `0`.
	Accuracy *float64 `json:"accuracy"`
}

type BrowserTypeLaunchPersistentContextOptionsHttpCredentials added in v0.1100.0

type BrowserTypeLaunchPersistentContextOptionsHttpCredentials struct {
	Username *string `json:"username"`
	Password *string `json:"password"`
}

type BrowserTypeLaunchPersistentContextOptionsProxy added in v0.1100.0

type BrowserTypeLaunchPersistentContextOptionsProxy struct {
	// Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example `http://myproxy.com:3128` or `socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy.
	Server *string `json:"server"`
	// Optional coma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.
	Bypass *string `json:"bypass"`
	// Optional username to use if HTTP proxy requires authentication.
	Username *string `json:"username"`
	// Optional password to use if HTTP proxy requires authentication.
	Password *string `json:"password"`
}

type BrowserTypeLaunchPersistentContextOptionsRecordVideo added in v0.1100.0

type BrowserTypeLaunchPersistentContextOptionsRecordVideo struct {
	// Path to the directory to put videos into.
	Dir *string `json:"dir"`
	// Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will be scaled down if necessary to fit the specified size.
	Size *BrowserTypeLaunchPersistentContextOptionsRecordVideoSize `json:"size"`
}

type BrowserTypeLaunchPersistentContextOptionsRecordVideoSize added in v0.1100.0

type BrowserTypeLaunchPersistentContextOptionsRecordVideoSize struct {
	// Video frame width.
	Width *int `json:"width"`
	// Video frame height.
	Height *int `json:"height"`
}

type BrowserTypeLaunchPersistentContextOptionsScreen added in v0.1400.0

type BrowserTypeLaunchPersistentContextOptionsScreen struct {
	// page width in pixels.
	Width *int `json:"width"`
	// page height in pixels.
	Height *int `json:"height"`
}

type BrowserTypeLaunchPersistentContextOptionsViewport added in v0.1100.0

type BrowserTypeLaunchPersistentContextOptionsViewport struct {
	// page width in pixels.
	Width *int `json:"width"`
	// page height in pixels.
	Height *int `json:"height"`
}

type BrowserTypeProxy added in v0.1100.0

type BrowserTypeProxy struct {
	// Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example `http://myproxy.com:3128` or `socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy.
	Server *string `json:"server"`
	// Optional coma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.
	Bypass *string `json:"bypass"`
	// Optional username to use if HTTP proxy requires authentication.
	Username *string `json:"username"`
	// Optional password to use if HTTP proxy requires authentication.
	Password *string `json:"password"`
}

type BrowserTypeRecordVideo added in v0.1100.0

type BrowserTypeRecordVideo struct {
	// Path to the directory to put videos into.
	Dir *string `json:"dir"`
	// Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will be scaled down if necessary to fit the specified size.
	Size *BrowserTypeRecordVideoSize `json:"size"`
}

type BrowserTypeRecordVideoSize added in v0.1100.0

type BrowserTypeRecordVideoSize struct {
	// Video frame width.
	Width *int `json:"width"`
	// Video frame height.
	Height *int `json:"height"`
}

type BrowserTypeScreen added in v0.1400.0

type BrowserTypeScreen struct {
	// page width in pixels.
	Width *int `json:"width"`
	// page height in pixels.
	Height *int `json:"height"`
}

type BrowserTypeViewport added in v0.1100.0

type BrowserTypeViewport struct {
	// page width in pixels.
	Width *int `json:"width"`
	// page height in pixels.
	Height *int `json:"height"`
}

type BrowserViewport added in v0.1100.0

type BrowserViewport struct {
	// page width in pixels.
	Width *int `json:"width"`
	// page height in pixels.
	Height *int `json:"height"`
}

type CDPSession added in v0.1400.0

type CDPSession interface {
	EventEmitter
	// Detaches the CDPSession from the target. Once detached, the CDPSession object won't emit any events and can't be used to
	// send messages.
	Detach() error
	Send(method string, params map[string]interface{}) (interface{}, error)
}

The `CDPSession` instances are used to talk raw Chrome Devtools Protocol: - protocol methods can be called with `session.send` method. - protocol events can be subscribed to with `session.on` method. Useful links: - Documentation on DevTools Protocol can be found here: [DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/). - Getting Started with DevTools Protocol: https://github.com/aslushnikov/getting-started-with-cdp/blob/master/README.md

type ColorScheme added in v0.1100.0

type ColorScheme string

type ConsoleMessage

type ConsoleMessage interface {
	// List of arguments passed to a `console` function call. See also [`event: Page.console`].
	Args() []JSHandle
	Location() ConsoleMessageLocation
	String() string
	// The text of the console message.
	Text() string
	// One of the following values: `'log'`, `'debug'`, `'info'`, `'error'`, `'warning'`, `'dir'`, `'dirxml'`, `'table'`,
	// `'trace'`, `'clear'`, `'startGroup'`, `'startGroupCollapsed'`, `'endGroup'`, `'assert'`, `'profile'`, `'profileEnd'`,
	// `'count'`, `'timeEnd'`.
	Type() string
}

`ConsoleMessage` objects are dispatched by page via the [`event: Page.console`] event.

type ConsoleMessageLocation

type ConsoleMessageLocation struct {
	URL          string `json:"url"`
	LineNumber   int    `json:"lineNumber"`
	ColumnNumber int    `json:"columnNumber"`
}

ConsoleMessageLocation represents where a console message was logged in the browser

type Cookie struct {
	Name     string  `json:"name"`
	Value    string  `json:"value"`
	URL      string  `json:"url"`
	Domain   string  `json:"domain"`
	Path     string  `json:"path"`
	Expires  float64 `json:"expires"`
	HttpOnly bool    `json:"httpOnly"`
	Secure   bool    `json:"secure"`
	SameSite string  `json:"sameSite"`
}

type DeviceDescriptor

type DeviceDescriptor struct {
	UserAgent          string                            `json:"userAgent"`
	Viewport           *BrowserNewContextOptionsViewport `json:"viewport"`
	DeviceScaleFactor  float64                           `json:"deviceScaleFactor"`
	IsMobile           bool                              `json:"isMobile"`
	HasTouch           bool                              `json:"hasTouch"`
	DefaultBrowserType string                            `json:"defaultBrowserType"`
}

DeviceDescriptor represents a single device

type Dialog

type Dialog interface {
	// Returns when the dialog has been accepted.
	Accept(texts ...string) error
	// If dialog is prompt, returns default prompt value. Otherwise, returns empty string.
	DefaultValue() string
	// Returns when the dialog has been dismissed.
	Dismiss() error
	// A message displayed in the dialog.
	Message() string
	// Returns dialog's type, can be one of `alert`, `beforeunload`, `confirm` or `prompt`.
	Type() string
}

`Dialog` objects are dispatched by page via the [`event: Page.dialog`] event. An example of using `Dialog` class: > NOTE: Dialogs are dismissed automatically, unless there is a [`event: Page.dialog`] listener. When listener is present, it **must** either Dialog.accept`] or [`method: Dialog.dismiss() the dialog - otherwise the page will [freeze](https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop#never_blocking) waiting for the dialog, and actions like click will never finish.

type DialogAcceptOptions added in v0.1100.0

type DialogAcceptOptions struct {
	// A text to enter in prompt. Does not cause any effects if the dialog's `type` is not prompt. Optional.
	PromptText *string `json:"promptText"`
}

type Download

type Download interface {
	// Deletes the downloaded file. Will wait for the download to finish if necessary.
	Delete() error
	// Returns download error if any. Will wait for the download to finish if necessary.
	Failure() (string, error)
	// Returns path to the downloaded file in case of successful download. The method will wait for the download to finish if
	// necessary. The method throws when connected remotely.
	// Note that the download's file name is a random GUID, use Download.suggestedFilename() to get suggested file
	// name.
	Path() (string, error)
	// Copy the download to a user-specified path. It is safe to call this method while the download is still in progress. Will
	// wait for the download to finish if necessary.
	SaveAs(path string) error
	String() string
	// Returns suggested filename for this download. It is typically computed by the browser from the
	// [`Content-Disposition`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) response header
	// or the `download` attribute. See the spec on [whatwg](https://html.spec.whatwg.org/#downloading-resources). Different
	// browsers can use different logic for computing it.
	SuggestedFilename() string
	// Returns downloaded url.
	URL() string
	// Get the page that the download belongs to.
	Page() Page
	// Cancels a download. Will not fail if the download is already finished or canceled. Upon successful cancellations,
	// `download.failure()` would resolve to `'canceled'`.
	Cancel() error
}

`Download` objects are dispatched by page via the [`event: Page.download`] event. All the downloaded files belonging to the browser context are deleted when the browser context is closed. Download event is emitted once the download starts. Download path becomes available once download completes: > NOTE: Browser context **must** be created with the `acceptDownloads` set to `true` when user needs access to the downloaded content. If `acceptDownloads` is not set, download events are emitted, but the actual download is not performed and user has no access to the downloaded files.

type ElementHandle

type ElementHandle interface {
	JSHandle
	// This method returns the bounding box of the element, or `null` if the element is not visible. The bounding box is
	// calculated relative to the main frame viewport - which is usually the same as the browser window.
	// Scrolling affects the returned bonding box, similarly to
	// [Element.getBoundingClientRect](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect). That
	// means `x` and/or `y` may be negative.
	// Elements from child frames return the bounding box relative to the main frame, unlike the
	// [Element.getBoundingClientRect](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect).
	// Assuming the page is static, it is safe to use bounding box coordinates to perform input. For example, the following
	// snippet should click the center of the element.
	BoundingBox() (*Rect, error)
	// This method checks the element by performing the following steps:
	// 1. Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already checked,
	// this method returns immediately.
	// 1. Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.
	// 1. Scroll the element into view if needed.
	// 1. Use [`property: Page.mouse`] to click in the center of the element.
	// 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
	// 1. Ensure that the element is now checked. If not, this method throws.
	// If the element is detached from the DOM at any moment during the action, this method throws.
	// When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
	// zero timeout disables this.
	Check(options ...ElementHandleCheckOptions) error
	// This method clicks the element by performing the following steps:
	// 1. Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.
	// 1. Scroll the element into view if needed.
	// 1. Use [`property: Page.mouse`] to click in the center of the element, or the specified `position`.
	// 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
	// If the element is detached from the DOM at any moment during the action, this method throws.
	// When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
	// zero timeout disables this.
	Click(options ...ElementHandleClickOptions) error
	// Returns the content frame for element handles referencing iframe nodes, or `null` otherwise
	ContentFrame() (Frame, error)
	// This method double clicks the element by performing the following steps:
	// 1. Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.
	// 1. Scroll the element into view if needed.
	// 1. Use [`property: Page.mouse`] to double click in the center of the element, or the specified `position`.
	// 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the
	// first click of the `dblclick()` triggers a navigation event, this method will throw.
	// If the element is detached from the DOM at any moment during the action, this method throws.
	// When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
	// zero timeout disables this.
	// > NOTE: `elementHandle.dblclick()` dispatches two `click` events and a single `dblclick` event.
	Dblclick(options ...ElementHandleDblclickOptions) error
	// The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the element,
	// `click` is dispatched. This is equivalent to calling
	// [element.click()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click).
	// Under the hood, it creates an instance of an event based on the given `type`, initializes it with `eventInit` properties
	// and dispatches it on the element. Events are `composed`, `cancelable` and bubble by default.
	// Since `eventInit` is event-specific, please refer to the events documentation for the lists of initial properties:
	// - [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)
	// - [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)
	// - [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)
	// - [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)
	// - [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)
	// - [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)
	// - [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)
	// You can also specify `JSHandle` as the property value if you want live objects to be passed into the event:
	DispatchEvent(typ string, initObjects ...interface{}) error
	// Returns the return value of `expression`.
	// The method finds an element matching the specified selector in the `ElementHandle`s subtree and passes it as a first
	// argument to `expression`. See [Working with selectors](./selectors.md) for more details. If no elements match the
	// selector, the method throws an error.
	// If `expression` returns a [Promise], then ElementHandle.evalOnSelector() would wait for the promise to resolve
	// and return its value.
	// Examples:
	EvalOnSelector(selector string, expression string, options ...interface{}) (interface{}, error)
	// Returns the return value of `expression`.
	// The method finds all elements matching the specified selector in the `ElementHandle`'s subtree and passes an array of
	// matched elements as a first argument to `expression`. See [Working with selectors](./selectors.md) for more details.
	// If `expression` returns a [Promise], then ElementHandle.evalOnSelectorAll() would wait for the promise to
	// resolve and return its value.
	// Examples:
	// “`html
	// <div class="feed">
	// <div class="tweet">Hello!</div>
	// <div class="tweet">Hi!</div>
	// </div>
	// “`
	EvalOnSelectorAll(selector string, expression string, options ...interface{}) (interface{}, error)
	// This method waits for [actionability](./actionability.md) checks, focuses the element, fills it and triggers an `input`
	// event after filling. Note that you can pass an empty string to clear the input field.
	// If the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error.
	// However, if the element is inside the `<label>` element that has an associated
	// [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled
	// instead.
	// To send fine-grained keyboard events, use ElementHandle.type().
	Fill(value string, options ...ElementHandleFillOptions) error
	// Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element.
	Focus() error
	// Returns element attribute value.
	GetAttribute(name string) (string, error)
	// This method hovers over the element by performing the following steps:
	// 1. Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.
	// 1. Scroll the element into view if needed.
	// 1. Use [`property: Page.mouse`] to hover over the center of the element, or the specified `position`.
	// 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
	// If the element is detached from the DOM at any moment during the action, this method throws.
	// When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
	// zero timeout disables this.
	Hover(options ...ElementHandleHoverOptions) error
	// Returns the `element.innerHTML`.
	InnerHTML() (string, error)
	// Returns the `element.innerText`.
	InnerText() (string, error)
	// Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
	IsChecked() (bool, error)
	// Returns whether the element is disabled, the opposite of [enabled](./actionability.md#enabled).
	IsDisabled() (bool, error)
	// Returns whether the element is [editable](./actionability.md#editable).
	IsEditable() (bool, error)
	// Returns whether the element is [enabled](./actionability.md#enabled).
	IsEnabled() (bool, error)
	// Returns whether the element is hidden, the opposite of [visible](./actionability.md#visible).
	IsHidden() (bool, error)
	// Returns whether the element is [visible](./actionability.md#visible).
	IsVisible() (bool, error)
	// Returns the frame containing the given element.
	OwnerFrame() (Frame, error)
	// Focuses the element, and then uses Keyboard.down`] and [`method: Keyboard.up().
	// `key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)
	// value or a single character to generate the text for. A superset of the `key` values can be found
	// [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:
	// `F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`,
	// `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.
	// Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.
	// Holding down `Shift` will type the text that corresponds to the `key` in the upper case.
	// If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective
	// texts.
	// Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
	// modifier, modifier is pressed and being held while the subsequent key is being pressed.
	Press(key string, options ...ElementHandlePressOptions) error
	// The method finds an element matching the specified selector in the `ElementHandle`'s subtree. See
	// [Working with selectors](./selectors.md) for more details. If no elements match the selector, returns `null`.
	QuerySelector(selector string) (ElementHandle, error)
	// The method finds all elements matching the specified selector in the `ElementHandle`s subtree. See
	// [Working with selectors](./selectors.md) for more details. If no elements match the selector, returns empty array.
	QuerySelectorAll(selector string) ([]ElementHandle, error)
	// Returns the buffer with the captured screenshot.
	// This method waits for the [actionability](./actionability.md) checks, then scrolls element into view before taking a
	// screenshot. If the element is detached from DOM, the method throws an error.
	Screenshot(options ...ElementHandleScreenshotOptions) ([]byte, error)
	// This method waits for [actionability](./actionability.md) checks, then tries to scroll element into view, unless it is
	// completely visible as defined by
	// [IntersectionObserver](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)'s `ratio`.
	// Throws when `elementHandle` does not point to an element
	// [connected](https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected) to a Document or a ShadowRoot.
	ScrollIntoViewIfNeeded(options ...ElementHandleScrollIntoViewIfNeededOptions) error
	// This method waits for [actionability](./actionability.md) checks, waits until all specified options are present in the
	// `<select>` element and selects these options.
	// If the target element is not a `<select>` element, this method throws an error. However, if the element is inside the
	// `<label>` element that has an associated
	// [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be used instead.
	// Returns the array of option values that have been successfully selected.
	// Triggers a `change` and `input` event once all the provided options have been selected.
	SelectOption(values SelectOptionValues, options ...ElementHandleSelectOptionOptions) ([]string, error)
	// This method waits for [actionability](./actionability.md) checks, then focuses the element and selects all its text
	// content.
	SelectText(options ...ElementHandleSelectTextOptions) error
	// This method expects `elementHandle` to point to an
	// [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
	// Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they
	// are resolved relative to the the current working directory. For empty array, clears the selected files.
	SetInputFiles(files []InputFile, options ...ElementHandleSetInputFilesOptions) error
	// This method taps the element by performing the following steps:
	// 1. Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.
	// 1. Scroll the element into view if needed.
	// 1. Use [`property: Page.touchscreen`] to tap the center of the element, or the specified `position`.
	// 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
	// If the element is detached from the DOM at any moment during the action, this method throws.
	// When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
	// zero timeout disables this.
	// > NOTE: `elementHandle.tap()` requires that the `hasTouch` option of the browser context be set to true.
	Tap(options ...ElementHandleTapOptions) error
	// Returns the `node.textContent`.
	TextContent() (string, error)
	// Focuses the element, and then sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.
	// To press a special key, like `Control` or `ArrowDown`, use ElementHandle.press().
	// An example of typing into a text field and then submitting the form:
	Type(value string, options ...ElementHandleTypeOptions) error
	// This method checks the element by performing the following steps:
	// 1. Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already
	// unchecked, this method returns immediately.
	// 1. Wait for [actionability](./actionability.md) checks on the element, unless `force` option is set.
	// 1. Scroll the element into view if needed.
	// 1. Use [`property: Page.mouse`] to click in the center of the element.
	// 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
	// 1. Ensure that the element is now unchecked. If not, this method throws.
	// If the element is detached from the DOM at any moment during the action, this method throws.
	// When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
	// zero timeout disables this.
	Uncheck(options ...ElementHandleUncheckOptions) error
	// Returns when the element satisfies the `state`.
	// Depending on the `state` parameter, this method waits for one of the [actionability](./actionability.md) checks to pass.
	// This method throws when the element is detached while waiting, unless waiting for the `"hidden"` state.
	// - `"visible"` Wait until the element is [visible](./actionability.md#visible).
	// - `"hidden"` Wait until the element is [not visible](./actionability.md#visible) or
	// [not attached](./actionability.md#attached). Note that waiting for hidden does not throw when the element detaches.
	// - `"stable"` Wait until the element is both [visible](./actionability.md#visible) and
	// [stable](./actionability.md#stable).
	// - `"enabled"` Wait until the element is [enabled](./actionability.md#enabled).
	// - `"disabled"` Wait until the element is [not enabled](./actionability.md#enabled).
	// - `"editable"` Wait until the element is [editable](./actionability.md#editable).
	// If the element does not satisfy the condition for the `timeout` milliseconds, this method will throw.
	WaitForElementState(state string, options ...ElementHandleWaitForElementStateOptions) error
	// Returns element specified by selector when it satisfies `state` option. Returns `null` if waiting for `hidden` or
	// `detached`.
	// Wait for the `selector` relative to the element handle to satisfy `state` option (either appear/disappear from dom, or
	// become visible/hidden). If at the moment of calling the method `selector` already satisfies the condition, the method
	// will return immediately. If the selector doesn't satisfy the condition for the `timeout` milliseconds, the function will
	// throw.
	// > NOTE: This method does not work across navigations, use Page.waitForSelector() instead.
	WaitForSelector(selector string, options ...ElementHandleWaitForSelectorOptions) (ElementHandle, error)
	// Returns `input.value` for `<input>` or `<textarea>` or `<select>` element. Throws for non-input elements.
	InputValue(options ...ElementHandleInputValueOptions) (string, error)
}

ElementHandle represents an in-page DOM element. ElementHandles can be created with the Page.querySelector() method. ElementHandle prevents DOM element from garbage collection unless the handle is disposed with JSHandle.dispose(). ElementHandles are auto-disposed when their origin frame gets navigated. ElementHandle instances can be used as an argument in Page.evalOnSelector`] and [`method: Page.evaluate() methods. > NOTE: In most cases, you would want to use the `Locator` object instead. You should only use `ElementHandle` if you want to retain a handle to a particular DOM Node that you intend to pass into Page.evaluate() as an argument. The difference between the `Locator` and ElementHandle is that the ElementHandle points to a particular element, while `Locator` captures the logic of how to retrieve an element. In the example below, handle points to a particular DOM element on page. If that element changes text or is used by React to render an entirely different component, handle is still pointing to that very DOM element. This can lead to unexpected behaviors. With the locator, every time the `element` is used, up-to-date DOM element is located in the page using the selector. So in the snippet below, underlying DOM element is going to be located twice.

type ElementHandleBoundingBoxResult added in v0.1100.0

type ElementHandleBoundingBoxResult struct {
	// the x coordinate of the element in pixels.
	X *float64 `json:"x"`
	// the y coordinate of the element in pixels.
	Y *float64 `json:"y"`
	// the width of the element in pixels.
	Width *float64 `json:"width"`
	// the height of the element in pixels.
	Height *float64 `json:"height"`
}

Result of calling <see cref="ElementHandle.BoundingBox" />.

type ElementHandleCheckOptions

type ElementHandleCheckOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *ElementHandleCheckOptionsPosition `json:"position"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type ElementHandleCheckOptionsPosition added in v0.1400.0

type ElementHandleCheckOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type ElementHandleClickOptions

type ElementHandleClickOptions struct {
	// Defaults to `left`.
	Button *MouseButton `json:"button"`
	// defaults to 1. See [UIEvent.detail].
	ClickCount *int `json:"clickCount"`
	// Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.
	Delay *float64 `json:"delay"`
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
	Modifiers []KeyboardModifier `json:"modifiers"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *ElementHandleClickOptionsPosition `json:"position"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type ElementHandleClickOptionsPosition added in v0.1100.0

type ElementHandleClickOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type ElementHandleDblclickOptions

type ElementHandleDblclickOptions struct {
	// Defaults to `left`.
	Button *MouseButton `json:"button"`
	// Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.
	Delay *float64 `json:"delay"`
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
	Modifiers []KeyboardModifier `json:"modifiers"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *ElementHandleDblclickOptionsPosition `json:"position"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type ElementHandleDblclickOptionsPosition added in v0.1100.0

type ElementHandleDblclickOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type ElementHandleDispatchEventOptions added in v0.1100.0

type ElementHandleDispatchEventOptions struct {
	// Optional event-specific initialization properties.
	EventInit interface{} `json:"eventInit"`
}

type ElementHandleEvalOnSelectorAllOptions added in v0.1100.0

type ElementHandleEvalOnSelectorAllOptions struct {
	// Optional argument to pass to `expression`.
	Arg interface{} `json:"arg"`
}

type ElementHandleEvalOnSelectorOptions added in v0.1100.0

type ElementHandleEvalOnSelectorOptions struct {
	// Optional argument to pass to `expression`.
	Arg interface{} `json:"arg"`
}

type ElementHandleFillOptions

type ElementHandleFillOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type ElementHandleHoverOptions

type ElementHandleHoverOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
	Modifiers []KeyboardModifier `json:"modifiers"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *ElementHandleHoverOptionsPosition `json:"position"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type ElementHandleHoverOptionsPosition added in v0.1100.0

type ElementHandleHoverOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type ElementHandleInputValueOptions added in v0.1400.0

type ElementHandleInputValueOptions struct {
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type ElementHandlePosition added in v0.1100.0

type ElementHandlePosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type ElementHandlePressOptions

type ElementHandlePressOptions struct {
	// Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
	Delay *float64 `json:"delay"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type ElementHandleScreenshotOptions

type ElementHandleScreenshotOptions struct {
	// Hides default white background and allows capturing screenshots with transparency. Not applicable to `jpeg` images. Defaults to `false`.
	OmitBackground *bool `json:"omitBackground"`
	// The file path to save the image to. The screenshot type will be inferred from file extension. If `path` is a relative path, then it is resolved relative to the current working directory. If no path is provided, the image won't be saved to the disk.
	Path *string `json:"path"`
	// The quality of the image, between 0-100. Not applicable to `png` images.
	Quality *int `json:"quality"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// Specify screenshot type, defaults to `png`.
	Type *ScreenshotType `json:"type"`
}

type ElementHandleScrollIntoViewIfNeededOptions

type ElementHandleScrollIntoViewIfNeededOptions struct {
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type ElementHandleSelectOptionOptions

type ElementHandleSelectOptionOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type ElementHandleSelectTextOptions

type ElementHandleSelectTextOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type ElementHandleSetInputFilesOptions

type ElementHandleSetInputFilesOptions struct {
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type ElementHandleTapOptions

type ElementHandleTapOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
	Modifiers []KeyboardModifier `json:"modifiers"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *ElementHandleTapOptionsPosition `json:"position"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type ElementHandleTapOptionsPosition added in v0.1100.0

type ElementHandleTapOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type ElementHandleTypeOptions

type ElementHandleTypeOptions struct {
	// Time to wait between key presses in milliseconds. Defaults to 0.
	Delay *float64 `json:"delay"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type ElementHandleUncheckOptions

type ElementHandleUncheckOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *ElementHandleUncheckOptionsPosition `json:"position"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type ElementHandleUncheckOptionsPosition added in v0.1400.0

type ElementHandleUncheckOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type ElementHandleWaitForElementStateOptions

type ElementHandleWaitForElementStateOptions struct {
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type ElementHandleWaitForSelectorOptions

type ElementHandleWaitForSelectorOptions struct {
	// Defaults to `'visible'`. Can be either:
	// `'attached'` - wait for element to be present in DOM.
	// `'detached'` - wait for element to not be present in DOM.
	// `'visible'` - wait for element to have non-empty bounding box and no `visibility:hidden`. Note that element without any content or with `display:none` has an empty bounding box and is not considered visible.
	// `'hidden'` - wait for element to be either detached from DOM, or have an empty bounding box or `visibility:hidden`. This is opposite to the `'visible'` option.
	State *WaitForSelectorState `json:"state"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type ElementState added in v0.1100.0

type ElementState string

type Error

type Error struct {
	Name    string
	Message string
	Stack   string
}

Error represents a Playwright error

func (*Error) Error

func (e *Error) Error() string

type EventEmitter

type EventEmitter interface {
	Emit(name string, payload ...interface{})
	ListenerCount(name string) int
	On(name string, handler interface{})
	Once(name string, handler interface{})
	RemoveListener(name string, handler interface{})
}

type ExposedFunction added in v0.171.1

type ExposedFunction = func(args ...interface{}) interface{}

ExposedFunction represents the func signature of an exposed function

type FileChooser

type FileChooser interface {
	// Returns input element associated with this file chooser.
	Element() ElementHandle
	// Returns whether this file chooser accepts multiple files.
	IsMultiple() bool
	// Returns page this file chooser belongs to.
	Page() Page
	// Sets the value of the file input this chooser is associated with. If some of the `filePaths` are relative paths, then
	// they are resolved relative to the the current working directory. For empty array, clears the selected files.
	SetFiles(files []InputFile, options ...ElementHandleSetInputFilesOptions) error
}

`FileChooser` objects are dispatched by the page in the [`event: Page.fileChooser`] event.

type FileChooserSetFilesOptions

type FileChooserSetFilesOptions struct {
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type Frame

type Frame interface {
	// Returns the added tag when the script's onload fires or when the script content was injected into frame.
	// Adds a `<script>` tag into the page with the desired url or content.
	AddScriptTag(options PageAddScriptTagOptions) (ElementHandle, error)
	// Returns the added tag when the stylesheet's onload fires or when the CSS content was injected into frame.
	// Adds a `<link rel="stylesheet">` tag into the page with the desired url or a `<style type="text/css">` tag with the
	// content.
	AddStyleTag(options PageAddStyleTagOptions) (ElementHandle, error)
	// This method checks an element matching `selector` by performing the following steps:
	// 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
	// 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already
	// checked, this method returns immediately.
	// 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
	// element is detached during the checks, the whole action is retried.
	// 1. Scroll the element into view if needed.
	// 1. Use [`property: Page.mouse`] to click in the center of the element.
	// 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
	// 1. Ensure that the element is now checked. If not, this method throws.
	// When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
	// zero timeout disables this.
	Check(selector string, options ...FrameCheckOptions) error
	ChildFrames() []Frame
	// This method clicks an element matching `selector` by performing the following steps:
	// 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
	// 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
	// element is detached during the checks, the whole action is retried.
	// 1. Scroll the element into view if needed.
	// 1. Use [`property: Page.mouse`] to click in the center of the element, or the specified `position`.
	// 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
	// When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
	// zero timeout disables this.
	Click(selector string, options ...PageClickOptions) error
	// Gets the full HTML contents of the frame, including the doctype.
	Content() (string, error)
	// This method double clicks an element matching `selector` by performing the following steps:
	// 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
	// 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
	// element is detached during the checks, the whole action is retried.
	// 1. Scroll the element into view if needed.
	// 1. Use [`property: Page.mouse`] to double click in the center of the element, or the specified `position`.
	// 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the
	// first click of the `dblclick()` triggers a navigation event, this method will throw.
	// When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
	// zero timeout disables this.
	// > NOTE: `frame.dblclick()` dispatches two `click` events and a single `dblclick` event.
	Dblclick(selector string, options ...FrameDblclickOptions) error
	// The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the element,
	// `click` is dispatched. This is equivalent to calling
	// [element.click()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click).
	// Under the hood, it creates an instance of an event based on the given `type`, initializes it with `eventInit` properties
	// and dispatches it on the element. Events are `composed`, `cancelable` and bubble by default.
	// Since `eventInit` is event-specific, please refer to the events documentation for the lists of initial properties:
	// - [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)
	// - [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)
	// - [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)
	// - [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)
	// - [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)
	// - [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)
	// - [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)
	// You can also specify `JSHandle` as the property value if you want live objects to be passed into the event:
	DispatchEvent(selector, typ string, eventInit interface{}, options ...PageDispatchEventOptions) error
	// Returns the return value of `expression`.
	// If the function passed to the Frame.evaluate`] returns a [Promise], then [`method: Frame.evaluate() would wait
	// for the promise to resolve and return its value.
	// If the function passed to the Frame.evaluate() returns a non-[Serializable] value, then
	// Frame.evaluate() returns `undefined`. Playwright also supports transferring some additional values that are
	// not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`.
	// A string can also be passed in instead of a function.
	// `ElementHandle` instances can be passed as an argument to the Frame.evaluate():
	Evaluate(expression string, options ...interface{}) (interface{}, error)
	// Returns the return value of `expression` as a `JSHandle`.
	// The only difference between Frame.evaluate`] and [`method: Frame.evaluateHandle() is that
	// Frame.evaluateHandle() returns `JSHandle`.
	// If the function, passed to the Frame.evaluateHandle(), returns a [Promise], then
	// Frame.evaluateHandle() would wait for the promise to resolve and return its value.
	// A string can also be passed in instead of a function.
	// `JSHandle` instances can be passed as an argument to the Frame.evaluateHandle():
	EvaluateHandle(expression string, options ...interface{}) (JSHandle, error)
	// Returns the return value of `expression`.
	// The method finds an element matching the specified selector within the frame and passes it as a first argument to
	// `expression`. See [Working with selectors](./selectors.md) for more details. If no elements match the selector, the
	// method throws an error.
	// If `expression` returns a [Promise], then Frame.evalOnSelector() would wait for the promise to resolve and
	// return its value.
	// Examples:
	EvalOnSelector(selector string, expression string, options ...interface{}) (interface{}, error)
	// Returns the return value of `expression`.
	// The method finds all elements matching the specified selector within the frame and passes an array of matched elements
	// as a first argument to `expression`. See [Working with selectors](./selectors.md) for more details.
	// If `expression` returns a [Promise], then Frame.evalOnSelectorAll() would wait for the promise to resolve and
	// return its value.
	// Examples:
	EvalOnSelectorAll(selector string, expression string, options ...interface{}) (interface{}, error)
	// This method waits for an element matching `selector`, waits for [actionability](./actionability.md) checks, focuses the
	// element, fills it and triggers an `input` event after filling. Note that you can pass an empty string to clear the input
	// field.
	// If the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error.
	// However, if the element is inside the `<label>` element that has an associated
	// [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled
	// instead.
	// To send fine-grained keyboard events, use Frame.type().
	Fill(selector string, value string, options ...FrameFillOptions) error
	// This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the method
	// waits until a matching element appears in the DOM.
	Focus(selector string, options ...FrameFocusOptions) error
	// Returns the `frame` or `iframe` element handle which corresponds to this frame.
	// This is an inverse of ElementHandle.contentFrame(). Note that returned handle actually belongs to the parent
	// frame.
	// This method throws an error if the frame has been detached before `frameElement()` returns.
	FrameElement() (ElementHandle, error)
	// Returns element attribute value.
	GetAttribute(selector string, name string, options ...PageGetAttributeOptions) (string, error)
	// Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
	// last redirect.
	// `frame.goto` will throw an error if:
	// - there's an SSL error (e.g. in case of self-signed certificates).
	// - target URL is invalid.
	// - the `timeout` is exceeded during navigation.
	// - the remote server does not respond or is unreachable.
	// - the main resource failed to load.
	// `frame.goto` will not throw an error when any valid HTTP status code is returned by the remote server, including 404
	// "Not Found" and 500 "Internal Server Error".  The status code for such responses can be retrieved by calling
	// Response.status().
	// > NOTE: `frame.goto` either throws an error or returns a main resource response. The only exceptions are navigation to
	// `about:blank` or navigation to the same URL with a different hash, which would succeed and return `null`.
	// > NOTE: Headless mode doesn't support navigation to a PDF document. See the
	// [upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295).
	Goto(url string, options ...PageGotoOptions) (Response, error)
	// This method hovers over an element matching `selector` by performing the following steps:
	// 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
	// 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
	// element is detached during the checks, the whole action is retried.
	// 1. Scroll the element into view if needed.
	// 1. Use [`property: Page.mouse`] to hover over the center of the element, or the specified `position`.
	// 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
	// When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
	// zero timeout disables this.
	Hover(selector string, options ...PageHoverOptions) error
	// Returns `element.innerHTML`.
	InnerHTML(selector string, options ...PageInnerHTMLOptions) (string, error)
	// Returns `element.innerText`.
	InnerText(selector string, options ...PageInnerTextOptions) (string, error)
	// Returns `true` if the frame has been detached, or `false` otherwise.
	IsDetached() bool
	// Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
	IsChecked(selector string, options ...FrameIsCheckedOptions) (bool, error)
	// Returns whether the element is disabled, the opposite of [enabled](./actionability.md#enabled).
	IsDisabled(selector string, options ...FrameIsDisabledOptions) (bool, error)
	// Returns whether the element is [editable](./actionability.md#editable).
	IsEditable(selector string, options ...FrameIsEditableOptions) (bool, error)
	// Returns whether the element is [enabled](./actionability.md#enabled).
	IsEnabled(selector string, options ...FrameIsEnabledOptions) (bool, error)
	// Returns whether the element is hidden, the opposite of [visible](./actionability.md#visible).  `selector` that does not
	// match any elements is considered hidden.
	IsHidden(selector string, options ...FrameIsHiddenOptions) (bool, error)
	// Returns whether the element is [visible](./actionability.md#visible). `selector` that does not match any elements is
	// considered not visible.
	IsVisible(selector string, options ...FrameIsVisibleOptions) (bool, error)
	// Returns frame's name attribute as specified in the tag.
	// If the name is empty, returns the id attribute instead.
	// > NOTE: This value is calculated once when the frame is created, and will not update if the attribute is changed later.
	Name() string
	// Returns the page containing this frame.
	Page() Page
	// Parent frame, if any. Detached frames and main frames return `null`.
	ParentFrame() Frame
	// `key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)
	// value or a single character to generate the text for. A superset of the `key` values can be found
	// [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:
	// `F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`,
	// `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.
	// Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.
	// Holding down `Shift` will type the text that corresponds to the `key` in the upper case.
	// If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective
	// texts.
	// Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
	// modifier, modifier is pressed and being held while the subsequent key is being pressed.
	Press(selector, key string, options ...PagePressOptions) error
	// Returns the ElementHandle pointing to the frame element.
	// The method finds an element matching the specified selector within the frame. See
	// [Working with selectors](./selectors.md) for more details. If no elements match the selector, returns `null`.
	QuerySelector(selector string) (ElementHandle, error)
	// Returns the ElementHandles pointing to the frame elements.
	// The method finds all elements matching the specified selector within the frame. See
	// [Working with selectors](./selectors.md) for more details. If no elements match the selector, returns empty array.
	QuerySelectorAll(selector string) ([]ElementHandle, error)
	SetContent(content string, options ...PageSetContentOptions) error
	// This method waits for an element matching `selector`, waits for [actionability](./actionability.md) checks, waits until
	// all specified options are present in the `<select>` element and selects these options.
	// If the target element is not a `<select>` element, this method throws an error. However, if the element is inside the
	// `<label>` element that has an associated
	// [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be used instead.
	// Returns the array of option values that have been successfully selected.
	// Triggers a `change` and `input` event once all the provided options have been selected.
	SelectOption(selector string, values SelectOptionValues, options ...FrameSelectOptionOptions) ([]string, error)
	// This method expects `selector` to point to an
	// [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
	// Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they
	// are resolved relative to the the current working directory. For empty array, clears the selected files.
	SetInputFiles(selector string, files []InputFile, options ...FrameSetInputFilesOptions) error
	// This method taps an element matching `selector` by performing the following steps:
	// 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
	// 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
	// element is detached during the checks, the whole action is retried.
	// 1. Scroll the element into view if needed.
	// 1. Use [`property: Page.touchscreen`] to tap the center of the element, or the specified `position`.
	// 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
	// When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
	// zero timeout disables this.
	// > NOTE: `frame.tap()` requires that the `hasTouch` option of the browser context be set to true.
	Tap(selector string, options ...FrameTapOptions) error
	// Returns `element.textContent`.
	TextContent(selector string, options ...FrameTextContentOptions) (string, error)
	// Returns the page title.
	Title() (string, error)
	// Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text. `frame.type` can be used to
	// send fine-grained keyboard events. To fill values in form fields, use Frame.fill().
	// To press a special key, like `Control` or `ArrowDown`, use Keyboard.press().
	Type(selector, text string, options ...PageTypeOptions) error
	// Returns frame's url.
	URL() string
	// This method checks an element matching `selector` by performing the following steps:
	// 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
	// 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already
	// unchecked, this method returns immediately.
	// 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
	// element is detached during the checks, the whole action is retried.
	// 1. Scroll the element into view if needed.
	// 1. Use [`property: Page.mouse`] to click in the center of the element.
	// 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
	// 1. Ensure that the element is now unchecked. If not, this method throws.
	// When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
	// zero timeout disables this.
	Uncheck(selector string, options ...FrameUncheckOptions) error
	WaitForEvent(event string, predicate ...interface{}) interface{}
	// Returns when the `expression` returns a truthy value, returns that value.
	// The Frame.waitForFunction() can be used to observe viewport size change:
	// To pass an argument to the predicate of `frame.waitForFunction` function:
	WaitForFunction(expression string, arg interface{}, options ...FrameWaitForFunctionOptions) (JSHandle, error)
	// Waits for the required load state to be reached.
	// This returns when the frame reaches a required load state, `load` by default. The navigation must have been committed
	// when this method is called. If current document has already reached the required state, resolves immediately.
	WaitForLoadState(given ...string)
	// Waits for the frame navigation and returns the main resource response. In case of multiple redirects, the navigation
	// will resolve with the response of the last redirect. In case of navigation to a different anchor or navigation due to
	// History API usage, the navigation will resolve with `null`.
	// This method waits for the frame to navigate to a new URL. It is useful for when you run code which will indirectly cause
	// the frame to navigate. Consider this example:
	// > NOTE: Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is
	// considered a navigation.
	WaitForNavigation(options ...PageWaitForNavigationOptions) (Response, error)
	// Waits for the frame to navigate to the given URL.
	WaitForURL(url string, options ...FrameWaitForURLOptions) error
	// Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or
	// `detached`.
	// Wait for the `selector` to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If at
	// the moment of calling the method `selector` already satisfies the condition, the method will return immediately. If the
	// selector doesn't satisfy the condition for the `timeout` milliseconds, the function will throw.
	// This method works across navigations:
	WaitForSelector(selector string, options ...PageWaitForSelectorOptions) (ElementHandle, error)
	// Waits for the given `timeout` in milliseconds.
	// Note that `frame.waitForTimeout()` should only be used for debugging. Tests using the timer in production are going to
	// be flaky. Use signals such as network events, selectors becoming visible and others instead.
	WaitForTimeout(timeout float64)
	// Returns `input.value` for the selected `<input>` or `<textarea>` or `<select>` element. Throws for non-input elements.
	InputValue(selector string, options ...FrameInputValueOptions) (string, error)
	DragAndDrop(source, target string, options ...FrameDragAndDropOptions) error
}

At every point of time, page exposes its current frame tree via the Page.mainFrame() and Frame.childFrames() methods. `Frame` object's lifecycle is controlled by three events, dispatched on the page object: - [`event: Page.frameAttached`] - fired when the frame gets attached to the page. A Frame can be attached to the page only once. - [`event: Page.frameNavigated`] - fired when the frame commits navigation to a different URL. - [`event: Page.frameDetached`] - fired when the frame gets detached from the page. A Frame can be detached from the page only once. An example of dumping frame tree:

type FrameAddScriptTagOptions

type FrameAddScriptTagOptions struct {
	// Raw JavaScript content to be injected into frame.
	Content *string `json:"content"`
	// Path to the JavaScript file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory.
	Path *string `json:"path"`
	// Script type. Use 'module' in order to load a Javascript ES6 module. See [script](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) for more details.
	Type *string `json:"type"`
	// URL of a script to be added.
	URL *string `json:"url"`
}

type FrameAddStyleTagOptions

type FrameAddStyleTagOptions struct {
	// Raw CSS content to be injected into frame.
	Content *string `json:"content"`
	// Path to the CSS file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory.
	Path *string `json:"path"`
	// URL of the `<link>` tag.
	URL *string `json:"url"`
}

type FrameCheckOptions

type FrameCheckOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *FrameCheckOptionsPosition `json:"position"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type FrameCheckOptionsPosition added in v0.1400.0

type FrameCheckOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type FrameClickOptions

type FrameClickOptions struct {
	// Defaults to `left`.
	Button *MouseButton `json:"button"`
	// defaults to 1. See [UIEvent.detail].
	ClickCount *int `json:"clickCount"`
	// Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.
	Delay *float64 `json:"delay"`
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
	Modifiers []KeyboardModifier `json:"modifiers"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *FrameClickOptionsPosition `json:"position"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type FrameClickOptionsPosition added in v0.1100.0

type FrameClickOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type FrameDblclickOptions

type FrameDblclickOptions struct {
	// Defaults to `left`.
	Button *MouseButton `json:"button"`
	// Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.
	Delay *float64 `json:"delay"`
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
	Modifiers []KeyboardModifier `json:"modifiers"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *FrameDblclickOptionsPosition `json:"position"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type FrameDblclickOptionsPosition added in v0.1100.0

type FrameDblclickOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type FrameDispatchEventOptions

type FrameDispatchEventOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type FrameDragAndDropOptions added in v0.1400.0

type FrameDragAndDropOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not specified, some visible point of the element is used.
	SourcePosition *FrameDragAndDropOptionsSourcePosition `json:"sourcePosition"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Drops on the target element at this point relative to the top-left corner of the element's padding box. If not specified, some visible point of the element is used.
	TargetPosition *FrameDragAndDropOptionsTargetPosition `json:"targetPosition"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type FrameDragAndDropOptionsSourcePosition added in v0.1400.0

type FrameDragAndDropOptionsSourcePosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type FrameDragAndDropOptionsTargetPosition added in v0.1400.0

type FrameDragAndDropOptionsTargetPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type FrameEvalOnSelectorAllOptions added in v0.1100.0

type FrameEvalOnSelectorAllOptions struct {
	// Optional argument to pass to `expression`.
	Arg interface{} `json:"arg"`
}

type FrameEvalOnSelectorOptions added in v0.1100.0

type FrameEvalOnSelectorOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
}

type FrameEvaluateHandleOptions added in v0.1100.0

type FrameEvaluateHandleOptions struct {
	// Optional argument to pass to `expression`.
	Arg interface{} `json:"arg"`
}

type FrameEvaluateOptions added in v0.1100.0

type FrameEvaluateOptions struct {
	// Optional argument to pass to `expression`.
	Arg interface{} `json:"arg"`
}

type FrameFillOptions

type FrameFillOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type FrameFocusOptions

type FrameFocusOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type FrameGetAttributeOptions

type FrameGetAttributeOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type FrameGotoOptions

type FrameGotoOptions struct {
	// Referer header value. If provided it will take preference over the referer header value set by Page.SetExtraHttpHeaders().
	Referer *string `json:"referer"`
	// Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultNavigationTimeout(), BrowserContext.SetDefaultTimeout(), Page.SetDefaultNavigationTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When to consider operation succeeded, defaults to `load`. Events can be either:
	// `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
	// `'load'` - consider operation to be finished when the `load` event is fired.
	// `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.
	WaitUntil *WaitUntilState `json:"waitUntil"`
}

type FrameHoverOptions

type FrameHoverOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
	Modifiers []KeyboardModifier `json:"modifiers"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *FrameHoverOptionsPosition `json:"position"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type FrameHoverOptionsPosition added in v0.1100.0

type FrameHoverOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type FrameInnerHTMLOptions

type FrameInnerHTMLOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type FrameInnerTextOptions

type FrameInnerTextOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type FrameInputValueOptions added in v0.1400.0

type FrameInputValueOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type FrameIsCheckedOptions added in v0.1100.0

type FrameIsCheckedOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type FrameIsDisabledOptions added in v0.1100.0

type FrameIsDisabledOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type FrameIsEditableOptions added in v0.1100.0

type FrameIsEditableOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type FrameIsEnabledOptions added in v0.1100.0

type FrameIsEnabledOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type FrameIsHiddenOptions added in v0.1100.0

type FrameIsHiddenOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type FrameIsVisibleOptions added in v0.1100.0

type FrameIsVisibleOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type FramePosition added in v0.1100.0

type FramePosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type FramePressOptions

type FramePressOptions struct {
	// Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
	Delay *float64 `json:"delay"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type FrameQuerySelectorOptions added in v0.1400.0

type FrameQuerySelectorOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
}

type FrameReceivedPayload added in v0.1100.0

type FrameReceivedPayload struct {
	// frame payload
	Payload []byte `json:"payload"`
}

type FrameSelectOptionOptions

type FrameSelectOptionOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type FrameSentPayload added in v0.1100.0

type FrameSentPayload struct {
	// frame payload
	Payload []byte `json:"payload"`
}

type FrameSetContentOptions

type FrameSetContentOptions struct {
	// Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultNavigationTimeout(), BrowserContext.SetDefaultTimeout(), Page.SetDefaultNavigationTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When to consider operation succeeded, defaults to `load`. Events can be either:
	// `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
	// `'load'` - consider operation to be finished when the `load` event is fired.
	// `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.
	WaitUntil *WaitUntilState `json:"waitUntil"`
}

type FrameSetInputFilesOptions

type FrameSetInputFilesOptions struct {
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type FrameSourcePosition added in v0.1400.0

type FrameSourcePosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type FrameTapOptions

type FrameTapOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
	Modifiers []KeyboardModifier `json:"modifiers"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *FrameTapOptionsPosition `json:"position"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type FrameTapOptionsPosition added in v0.1100.0

type FrameTapOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type FrameTargetPosition added in v0.1400.0

type FrameTargetPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type FrameTextContentOptions

type FrameTextContentOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type FrameTypeOptions

type FrameTypeOptions struct {
	// Time to wait between key presses in milliseconds. Defaults to 0.
	Delay *float64 `json:"delay"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type FrameUncheckOptions

type FrameUncheckOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *FrameUncheckOptionsPosition `json:"position"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type FrameUncheckOptionsPosition added in v0.1400.0

type FrameUncheckOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type FrameWaitForFunctionOptions

type FrameWaitForFunctionOptions struct {
	// If `polling` is `'raf'`, then `expression` is constantly executed in `requestAnimationFrame` callback. If `polling` is a number, then it is treated as an interval in milliseconds at which the function would be executed. Defaults to `raf`.
	Polling interface{} `json:"polling"`
	// maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout().
	Timeout *float64 `json:"timeout"`
}

type FrameWaitForLoadStateOptions

type FrameWaitForLoadStateOptions struct {
	// Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultNavigationTimeout(), BrowserContext.SetDefaultTimeout(), Page.SetDefaultNavigationTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type FrameWaitForNavigationOptions

type FrameWaitForNavigationOptions struct {
	// Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultNavigationTimeout(), BrowserContext.SetDefaultTimeout(), Page.SetDefaultNavigationTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation.
	URL interface{} `json:"url"`
	// When to consider operation succeeded, defaults to `load`. Events can be either:
	// `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
	// `'load'` - consider operation to be finished when the `load` event is fired.
	// `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.
	WaitUntil *WaitUntilState `json:"waitUntil"`
}

type FrameWaitForSelectorOptions

type FrameWaitForSelectorOptions struct {
	// Defaults to `'visible'`. Can be either:
	// `'attached'` - wait for element to be present in DOM.
	// `'detached'` - wait for element to not be present in DOM.
	// `'visible'` - wait for element to have non-empty bounding box and no `visibility:hidden`. Note that element without any content or with `display:none` has an empty bounding box and is not considered visible.
	// `'hidden'` - wait for element to be either detached from DOM, or have an empty bounding box or `visibility:hidden`. This is opposite to the `'visible'` option.
	State *WaitForSelectorState `json:"state"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type FrameWaitForURLOptions added in v0.1400.0

type FrameWaitForURLOptions struct {
	// Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultNavigationTimeout(), BrowserContext.SetDefaultTimeout(), Page.SetDefaultNavigationTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When to consider operation succeeded, defaults to `load`. Events can be either:
	// `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
	// `'load'` - consider operation to be finished when the `load` event is fired.
	// `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.
	WaitUntil *WaitUntilState `json:"waitUntil"`
}

type InputFile

type InputFile struct {
	Name     string
	MimeType string
	Buffer   []byte
}

InputFile represents the input file for: - FileChooser.SetFiles() - ElementHandle.SetInputFiles() - Page.SetInputFiles()

type JSHandle

type JSHandle interface {
	// Returns either `null` or the object handle itself, if the object handle is an instance of `ElementHandle`.
	AsElement() ElementHandle
	// The `jsHandle.dispose` method stops referencing the element handle.
	Dispose() error
	// Returns the return value of `expression`.
	// This method passes this handle as the first argument to `expression`.
	// If `expression` returns a [Promise], then `handle.evaluate` would wait for the promise to resolve and return its value.
	// Examples:
	Evaluate(expression string, options ...interface{}) (interface{}, error)
	// Returns the return value of `expression` as a `JSHandle`.
	// This method passes this handle as the first argument to `expression`.
	// The only difference between `jsHandle.evaluate` and `jsHandle.evaluateHandle` is that `jsHandle.evaluateHandle` returns
	// `JSHandle`.
	// If the function passed to the `jsHandle.evaluateHandle` returns a [Promise], then `jsHandle.evaluateHandle` would wait
	// for the promise to resolve and return its value.
	// See Page.evaluateHandle() for more details.
	EvaluateHandle(expression string, options ...interface{}) (JSHandle, error)
	// The method returns a map with **own property names** as keys and JSHandle instances for the property values.
	GetProperties() (map[string]JSHandle, error)
	// Fetches a single property from the referenced object.
	GetProperty(name string) (JSHandle, error)
	// Returns a JSON representation of the object. If the object has a `toJSON` function, it **will not be called**.
	// > NOTE: The method will return an empty JSON object if the referenced object is not stringifiable. It will throw an
	// error if the object has circular references.
	JSONValue() (interface{}, error)
	String() string
}

JSHandle represents an in-page JavaScript object. JSHandles can be created with the Page.evaluateHandle() method. JSHandle prevents the referenced JavaScript object being garbage collected unless the handle is exposed with JSHandle.dispose(). JSHandles are auto-disposed when their origin frame gets navigated or the parent context gets destroyed. JSHandle instances can be used as an argument in Page.evalOnSelector`], [`method: Page.evaluate() and Page.evaluateHandle() methods.

type JSHandleEvaluateHandleOptions added in v0.1100.0

type JSHandleEvaluateHandleOptions struct {
	// Optional argument to pass to `expression`.
	Arg interface{} `json:"arg"`
}

type JSHandleEvaluateOptions added in v0.1100.0

type JSHandleEvaluateOptions struct {
	// Optional argument to pass to `expression`.
	Arg interface{} `json:"arg"`
}

type Keyboard

type Keyboard interface {
	// Dispatches a `keydown` event.
	// `key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)
	// value or a single character to generate the text for. A superset of the `key` values can be found
	// [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:
	// `F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`,
	// `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.
	// Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.
	// Holding down `Shift` will type the text that corresponds to the `key` in the upper case.
	// If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective
	// texts.
	// If `key` is a modifier key, `Shift`, `Meta`, `Control`, or `Alt`, subsequent key presses will be sent with that modifier
	// active. To release the modifier key, use Keyboard.up().
	// After the key is pressed once, subsequent calls to Keyboard.down() will have
	// [repeat](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat) set to true. To release the key, use
	// Keyboard.up().
	// > NOTE: Modifier keys DO influence `keyboard.down`. Holding down `Shift` will type the text in upper case.
	Down(key string) error
	// Dispatches only `input` event, does not emit the `keydown`, `keyup` or `keypress` events.
	// > NOTE: Modifier keys DO NOT effect `keyboard.insertText`. Holding down `Shift` will not type the text in upper case.
	InsertText(text string) error
	// `key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)
	// value or a single character to generate the text for. A superset of the `key` values can be found
	// [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:
	// `F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`,
	// `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.
	// Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.
	// Holding down `Shift` will type the text that corresponds to the `key` in the upper case.
	// If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective
	// texts.
	// Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
	// modifier, modifier is pressed and being held while the subsequent key is being pressed.
	// Shortcut for Keyboard.down`] and [`method: Keyboard.up().
	Press(key string, options ...KeyboardPressOptions) error
	// Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.
	// To press a special key, like `Control` or `ArrowDown`, use Keyboard.press().
	// > NOTE: Modifier keys DO NOT effect `keyboard.type`. Holding down `Shift` will not type the text in upper case.
	// > NOTE: For characters that are not on a US keyboard, only an `input` event will be sent.
	Type(text string, options ...KeyboardTypeOptions) error
	// Dispatches a `keyup` event.
	Up(key string) error
}

Keyboard provides an api for managing a virtual keyboard. The high level api is Keyboard.type(), which takes raw characters and generates proper keydown, keypress/input, and keyup events on your page. For finer control, you can use Keyboard.down`], [`method: Keyboard.up`], and [`method: Keyboard.insertText() to manually fire events as if they were generated from a real keyboard. An example of holding down `Shift` in order to select and delete some text: An example of pressing uppercase `A` An example to trigger select-all with the keyboard

type KeyboardModifier added in v0.1100.0

type KeyboardModifier string

type KeyboardPressOptions

type KeyboardPressOptions struct {
	// Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
	Delay *float64 `json:"delay"`
}

type KeyboardTypeOptions

type KeyboardTypeOptions struct {
	// Time to wait between key presses in milliseconds. Defaults to 0.
	Delay *float64 `json:"delay"`
}

type LoadState added in v0.1100.0

type LoadState string

type LocalStorageEntry added in v0.1100.0

type LocalStorageEntry struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type LocatorBoundingBoxOptions added in v0.1400.0

type LocatorBoundingBoxOptions struct {
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorBoundingBoxResult added in v0.1400.0

type LocatorBoundingBoxResult struct {
	// the x coordinate of the element in pixels.
	X *float64 `json:"x"`
	// the y coordinate of the element in pixels.
	Y *float64 `json:"y"`
	// the width of the element in pixels.
	Width *float64 `json:"width"`
	// the height of the element in pixels.
	Height *float64 `json:"height"`
}

Result of calling <see cref="Locator.BoundingBox" />.

type LocatorCheckOptions added in v0.1400.0

type LocatorCheckOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *LocatorCheckOptionsPosition `json:"position"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type LocatorCheckOptionsPosition added in v0.1400.0

type LocatorCheckOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type LocatorClickOptions added in v0.1400.0

type LocatorClickOptions struct {
	// Defaults to `left`.
	Button *MouseButton `json:"button"`
	// defaults to 1. See [UIEvent.detail].
	ClickCount *int `json:"clickCount"`
	// Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.
	Delay *float64 `json:"delay"`
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
	Modifiers []KeyboardModifier `json:"modifiers"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *LocatorClickOptionsPosition `json:"position"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type LocatorClickOptionsPosition added in v0.1400.0

type LocatorClickOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type LocatorDblclickOptions added in v0.1400.0

type LocatorDblclickOptions struct {
	// Defaults to `left`.
	Button *MouseButton `json:"button"`
	// Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.
	Delay *float64 `json:"delay"`
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
	Modifiers []KeyboardModifier `json:"modifiers"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *LocatorDblclickOptionsPosition `json:"position"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type LocatorDblclickOptionsPosition added in v0.1400.0

type LocatorDblclickOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type LocatorDispatchEventOptions added in v0.1400.0

type LocatorDispatchEventOptions struct {
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorElementHandleOptions added in v0.1400.0

type LocatorElementHandleOptions struct {
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorEvaluateAllOptions added in v0.1400.0

type LocatorEvaluateAllOptions struct {
	// Optional argument to pass to `expression`.
	Arg interface{} `json:"arg"`
}

type LocatorEvaluateHandleOptions added in v0.1400.0

type LocatorEvaluateHandleOptions struct {
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorEvaluateOptions added in v0.1400.0

type LocatorEvaluateOptions struct {
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorFillOptions added in v0.1400.0

type LocatorFillOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorFocusOptions added in v0.1400.0

type LocatorFocusOptions struct {
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorGetAttributeOptions added in v0.1400.0

type LocatorGetAttributeOptions struct {
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorHoverOptions added in v0.1400.0

type LocatorHoverOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
	Modifiers []KeyboardModifier `json:"modifiers"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *LocatorHoverOptionsPosition `json:"position"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type LocatorHoverOptionsPosition added in v0.1400.0

type LocatorHoverOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type LocatorInnerHTMLOptions added in v0.1400.0

type LocatorInnerHTMLOptions struct {
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorInnerTextOptions added in v0.1400.0

type LocatorInnerTextOptions struct {
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorInputValueOptions added in v0.1400.0

type LocatorInputValueOptions struct {
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorIsCheckedOptions added in v0.1400.0

type LocatorIsCheckedOptions struct {
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorIsDisabledOptions added in v0.1400.0

type LocatorIsDisabledOptions struct {
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorIsEditableOptions added in v0.1400.0

type LocatorIsEditableOptions struct {
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorIsEnabledOptions added in v0.1400.0

type LocatorIsEnabledOptions struct {
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorIsHiddenOptions added in v0.1400.0

type LocatorIsHiddenOptions struct {
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorIsVisibleOptions added in v0.1400.0

type LocatorIsVisibleOptions struct {
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorPosition added in v0.1400.0

type LocatorPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type LocatorPressOptions added in v0.1400.0

type LocatorPressOptions struct {
	// Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
	Delay *float64 `json:"delay"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorScreenshotOptions added in v0.1400.0

type LocatorScreenshotOptions struct {
	// Hides default white background and allows capturing screenshots with transparency. Not applicable to `jpeg` images. Defaults to `false`.
	OmitBackground *bool `json:"omitBackground"`
	// The file path to save the image to. The screenshot type will be inferred from file extension. If `path` is a relative path, then it is resolved relative to the current working directory. If no path is provided, the image won't be saved to the disk.
	Path *string `json:"path"`
	// The quality of the image, between 0-100. Not applicable to `png` images.
	Quality *int `json:"quality"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// Specify screenshot type, defaults to `png`.
	Type *ScreenshotType `json:"type"`
}

type LocatorScrollIntoViewIfNeededOptions added in v0.1400.0

type LocatorScrollIntoViewIfNeededOptions struct {
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorSelectOptionOptions added in v0.1400.0

type LocatorSelectOptionOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorSelectTextOptions added in v0.1400.0

type LocatorSelectTextOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorSetInputFilesOptions added in v0.1400.0

type LocatorSetInputFilesOptions struct {
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorTapOptions added in v0.1400.0

type LocatorTapOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
	Modifiers []KeyboardModifier `json:"modifiers"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *LocatorTapOptionsPosition `json:"position"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type LocatorTapOptionsPosition added in v0.1400.0

type LocatorTapOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type LocatorTextContentOptions added in v0.1400.0

type LocatorTextContentOptions struct {
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorTypeOptions added in v0.1400.0

type LocatorTypeOptions struct {
	// Time to wait between key presses in milliseconds. Defaults to 0.
	Delay *float64 `json:"delay"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type LocatorUncheckOptions added in v0.1400.0

type LocatorUncheckOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *LocatorUncheckOptionsPosition `json:"position"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type LocatorUncheckOptionsPosition added in v0.1400.0

type LocatorUncheckOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type Media added in v0.1100.0

type Media string

type MixedState added in v0.1100.0

type MixedState string

type Mouse

type Mouse interface {
	// Shortcut for Mouse.move`], [`method: Mouse.down`], [`method: Mouse.up().
	Click(x, y float64, options ...MouseClickOptions) error
	// Shortcut for Mouse.move`], [`method: Mouse.down`], [`method: Mouse.up`], [`method: Mouse.down() and
	// Mouse.up().
	Dblclick(x, y float64, options ...MouseDblclickOptions) error
	// Dispatches a `mousedown` event.
	Down(options ...MouseDownOptions) error
	// Dispatches a `mousemove` event.
	Move(x float64, y float64, options ...MouseMoveOptions) error
	// Dispatches a `mouseup` event.
	Up(options ...MouseUpOptions) error
}

The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport. Every `page` object has its own Mouse, accessible with [`property: Page.mouse`].

type MouseButton added in v0.1100.0

type MouseButton string

type MouseClickOptions

type MouseClickOptions struct {
	// Defaults to `left`.
	Button *MouseButton `json:"button"`
	// defaults to 1. See [UIEvent.detail].
	ClickCount *int `json:"clickCount"`
	// Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.
	Delay *float64 `json:"delay"`
}

type MouseDblclickOptions

type MouseDblclickOptions struct {
	// Defaults to `left`.
	Button *MouseButton `json:"button"`
	// Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.
	Delay *float64 `json:"delay"`
}

type MouseDownOptions

type MouseDownOptions struct {
	// Defaults to `left`.
	Button *MouseButton `json:"button"`
	// defaults to 1. See [UIEvent.detail].
	ClickCount *int `json:"clickCount"`
}

type MouseMoveOptions

type MouseMoveOptions struct {
	// defaults to 1. Sends intermediate `mousemove` events.
	Steps *int `json:"steps"`
}

type MouseUpOptions

type MouseUpOptions struct {
	// Defaults to `left`.
	Button *MouseButton `json:"button"`
	// defaults to 1. See [UIEvent.detail].
	ClickCount *int `json:"clickCount"`
}

type NetworkCookie

type NetworkCookie struct {
	Name     string `json:"name"`
	Value    string `json:"value"`
	Domain   string `json:"domain"`
	Path     string `json:"path"`
	Expires  int    `json:"expires"`
	HttpOnly bool   `json:"httpOnly"`
	Secure   bool   `json:"secure"`
	SameSite string `json:"sameSite"`
}

NetworkCookie is the return structure of BrowserContext.Cookies()

type OriginsState added in v0.1100.0

type OriginsState struct {
	Origin       string              `json:"origin"`
	LocalStorage []LocalStorageEntry `json:"localStorage"`
}

type Page

type Page interface {
	EventEmitter
	Mouse() Mouse
	Keyboard() Keyboard
	Touchscreen() Touchscreen
	// Adds a script which would be evaluated in one of the following scenarios:
	// - Whenever the page is navigated.
	// - Whenever the child frame is attached or navigated. In this case, the script is evaluated in the context of the newly
	// attached frame.
	// The script is evaluated after the document was created but before any of its scripts were run. This is useful to amend
	// the JavaScript environment, e.g. to seed `Math.random`.
	// An example of overriding `Math.random` before the page loads:
	// > NOTE: The order of evaluation of multiple scripts installed via BrowserContext.addInitScript() and
	// Page.addInitScript() is not defined.
	AddInitScript(script PageAddInitScriptOptions) error
	// Adds a `<script>` tag into the page with the desired url or content. Returns the added tag when the script's onload
	// fires or when the script content was injected into frame.
	// Shortcut for main frame's Frame.addScriptTag().
	AddScriptTag(options PageAddScriptTagOptions) (ElementHandle, error)
	// Adds a `<link rel="stylesheet">` tag into the page with the desired url or a `<style type="text/css">` tag with the
	// content. Returns the added tag when the stylesheet's onload fires or when the CSS content was injected into frame.
	// Shortcut for main frame's Frame.addStyleTag().
	AddStyleTag(options PageAddStyleTagOptions) (ElementHandle, error)
	// Brings page to front (activates tab).
	BringToFront() error
	// This method checks an element matching `selector` by performing the following steps:
	// 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
	// 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already
	// checked, this method returns immediately.
	// 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
	// element is detached during the checks, the whole action is retried.
	// 1. Scroll the element into view if needed.
	// 1. Use [`property: Page.mouse`] to click in the center of the element.
	// 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
	// 1. Ensure that the element is now checked. If not, this method throws.
	// When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
	// zero timeout disables this.
	// Shortcut for main frame's Frame.check().
	Check(selector string, options ...FrameCheckOptions) error
	// This method clicks an element matching `selector` by performing the following steps:
	// 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
	// 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
	// element is detached during the checks, the whole action is retried.
	// 1. Scroll the element into view if needed.
	// 1. Use [`property: Page.mouse`] to click in the center of the element, or the specified `position`.
	// 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
	// When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
	// zero timeout disables this.
	// Shortcut for main frame's Frame.click().
	Click(selector string, options ...PageClickOptions) error
	// If `runBeforeUnload` is `false`, does not run any unload handlers and waits for the page to be closed. If
	// `runBeforeUnload` is `true` the method will run unload handlers, but will **not** wait for the page to close.
	// By default, `page.close()` **does not** run `beforeunload` handlers.
	// > NOTE: if `runBeforeUnload` is passed as true, a `beforeunload` dialog might be summoned and should be handled manually
	// via [`event: Page.dialog`] event.
	Close(options ...PageCloseOptions) error
	// Gets the full HTML contents of the page, including the doctype.
	Content() (string, error)
	// Get the browser context that the page belongs to.
	Context() BrowserContext
	// This method double clicks an element matching `selector` by performing the following steps:
	// 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
	// 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
	// element is detached during the checks, the whole action is retried.
	// 1. Scroll the element into view if needed.
	// 1. Use [`property: Page.mouse`] to double click in the center of the element, or the specified `position`.
	// 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the
	// first click of the `dblclick()` triggers a navigation event, this method will throw.
	// When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
	// zero timeout disables this.
	// > NOTE: `page.dblclick()` dispatches two `click` events and a single `dblclick` event.
	// Shortcut for main frame's Frame.dblclick().
	Dblclick(expression string, options ...FrameDblclickOptions) error
	// The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the element,
	// `click` is dispatched. This is equivalent to calling
	// [element.click()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click).
	// Under the hood, it creates an instance of an event based on the given `type`, initializes it with `eventInit` properties
	// and dispatches it on the element. Events are `composed`, `cancelable` and bubble by default.
	// Since `eventInit` is event-specific, please refer to the events documentation for the lists of initial properties:
	// - [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)
	// - [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)
	// - [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)
	// - [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)
	// - [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)
	// - [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)
	// - [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)
	// You can also specify `JSHandle` as the property value if you want live objects to be passed into the event:
	DispatchEvent(selector string, typ string, options ...PageDispatchEventOptions) error
	// The method adds a function called `name` on the `window` object of every frame in this page. When called, the function
	// executes `callback` and returns a [Promise] which resolves to the return value of `callback`. If the `callback` returns
	// a [Promise], it will be awaited.
	// The first argument of the `callback` function contains information about the caller: `{ browserContext: BrowserContext,
	// page: Page, frame: Frame }`.
	// See BrowserContext.exposeBinding() for the context-wide version.
	// > NOTE: Functions installed via Page.exposeBinding() survive navigations.
	// An example of exposing page URL to all frames in a page:
	// An example of passing an element handle:
	ExposeBinding(name string, binding BindingCallFunction, handle ...bool) error
	// The method adds a function called `name` on the `window` object of every frame in the page. When called, the function
	// executes `callback` and returns a [Promise] which resolves to the return value of `callback`.
	// If the `callback` returns a [Promise], it will be awaited.
	// See BrowserContext.exposeFunction() for context-wide exposed function.
	// > NOTE: Functions installed via Page.exposeFunction() survive navigations.
	// An example of adding a `sha256` function to the page:
	ExposeFunction(name string, binding ExposedFunction) error
	// This method changes the `CSS media type` through the `media` argument, and/or the `'prefers-colors-scheme'` media
	// feature, using the `colorScheme` argument.
	EmulateMedia(options ...PageEmulateMediaOptions) error
	// Returns the value of the `expression` invocation.
	// If the function passed to the Page.evaluate`] returns a [Promise], then [`method: Page.evaluate() would wait
	// for the promise to resolve and return its value.
	// If the function passed to the Page.evaluate() returns a non-[Serializable] value, then
	// Page.evaluate() resolves to `undefined`. Playwright also supports transferring some additional values that are
	// not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`.
	// Passing argument to `expression`:
	// A string can also be passed in instead of a function:
	// `ElementHandle` instances can be passed as an argument to the Page.evaluate():
	// Shortcut for main frame's Frame.evaluate().
	Evaluate(expression string, options ...interface{}) (interface{}, error)
	// Returns the value of the `expression` invocation as a `JSHandle`.
	// The only difference between Page.evaluate`] and [`method: Page.evaluateHandle() is that
	// Page.evaluateHandle() returns `JSHandle`.
	// If the function passed to the Page.evaluateHandle`] returns a [Promise], then [`method: Page.evaluateHandle()
	// would wait for the promise to resolve and return its value.
	// A string can also be passed in instead of a function:
	// `JSHandle` instances can be passed as an argument to the Page.evaluateHandle():
	EvaluateHandle(expression string, options ...interface{}) (JSHandle, error)
	// The method finds an element matching the specified selector within the page and passes it as a first argument to
	// `expression`. If no elements match the selector, the method throws an error. Returns the value of `expression`.
	// If `expression` returns a [Promise], then Page.evalOnSelector() would wait for the promise to resolve and
	// return its value.
	// Examples:
	// Shortcut for main frame's Frame.evalOnSelector().
	EvalOnSelector(selector string, expression string, options ...interface{}) (interface{}, error)
	// The method finds all elements matching the specified selector within the page and passes an array of matched elements as
	// a first argument to `expression`. Returns the result of `expression` invocation.
	// If `expression` returns a [Promise], then Page.evalOnSelectorAll() would wait for the promise to resolve and
	// return its value.
	// Examples:
	EvalOnSelectorAll(selector string, expression string, options ...interface{}) (interface{}, error)
	ExpectConsoleMessage(cb func() error) (ConsoleMessage, error)
	ExpectDownload(cb func() error) (Download, error)
	ExpectEvent(event string, cb func() error, predicates ...interface{}) (interface{}, error)
	ExpectFileChooser(cb func() error) (FileChooser, error)
	ExpectLoadState(state string, cb func() error) error
	ExpectNavigation(cb func() error, options ...PageWaitForNavigationOptions) (Response, error)
	ExpectPopup(cb func() error) (Page, error)
	ExpectRequest(url interface{}, cb func() error, options ...interface{}) (Request, error)
	ExpectResponse(url interface{}, cb func() error, options ...interface{}) (Response, error)
	ExpectWorker(cb func() error) (Worker, error)
	ExpectedDialog(cb func() error) (Dialog, error)
	// This method waits for an element matching `selector`, waits for [actionability](./actionability.md) checks, focuses the
	// element, fills it and triggers an `input` event after filling. Note that you can pass an empty string to clear the input
	// field.
	// If the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error.
	// However, if the element is inside the `<label>` element that has an associated
	// [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled
	// instead.
	// To send fine-grained keyboard events, use Page.type().
	// Shortcut for main frame's Frame.fill().
	Fill(selector, text string, options ...FrameFillOptions) error
	// This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the method
	// waits until a matching element appears in the DOM.
	// Shortcut for main frame's Frame.focus().
	Focus(expression string, options ...FrameFocusOptions) error
	// Returns frame matching the specified criteria. Either `name` or `url` must be specified.
	Frame(options PageFrameOptions) Frame
	// An array of all frames attached to the page.
	Frames() []Frame
	// Returns element attribute value.
	GetAttribute(selector string, name string, options ...PageGetAttributeOptions) (string, error)
	// Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
	// last redirect. If can not go back, returns `null`.
	// Navigate to the previous page in history.
	GoBack(options ...PageGoBackOptions) (Response, error)
	// Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
	// last redirect. If can not go forward, returns `null`.
	// Navigate to the next page in history.
	GoForward(options ...PageGoForwardOptions) (Response, error)
	// Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
	// last redirect.
	// `page.goto` will throw an error if:
	// - there's an SSL error (e.g. in case of self-signed certificates).
	// - target URL is invalid.
	// - the `timeout` is exceeded during navigation.
	// - the remote server does not respond or is unreachable.
	// - the main resource failed to load.
	// `page.goto` will not throw an error when any valid HTTP status code is returned by the remote server, including 404 "Not
	// Found" and 500 "Internal Server Error".  The status code for such responses can be retrieved by calling
	// Response.status().
	// > NOTE: `page.goto` either throws an error or returns a main resource response. The only exceptions are navigation to
	// `about:blank` or navigation to the same URL with a different hash, which would succeed and return `null`.
	// > NOTE: Headless mode doesn't support navigation to a PDF document. See the
	// [upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295).
	// Shortcut for main frame's Frame.goto()
	Goto(url string, options ...PageGotoOptions) (Response, error)
	// This method hovers over an element matching `selector` by performing the following steps:
	// 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
	// 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
	// element is detached during the checks, the whole action is retried.
	// 1. Scroll the element into view if needed.
	// 1. Use [`property: Page.mouse`] to hover over the center of the element, or the specified `position`.
	// 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
	// When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
	// zero timeout disables this.
	// Shortcut for main frame's Frame.hover().
	Hover(selector string, options ...PageHoverOptions) error
	// Returns `element.innerHTML`.
	InnerHTML(selector string, options ...PageInnerHTMLOptions) (string, error)
	// Returns `element.innerText`.
	InnerText(selector string, options ...PageInnerTextOptions) (string, error)
	// Indicates that the page has been closed.
	IsClosed() bool
	// Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
	IsChecked(selector string, options ...FrameIsCheckedOptions) (bool, error)
	// Returns whether the element is disabled, the opposite of [enabled](./actionability.md#enabled).
	IsDisabled(selector string, options ...FrameIsDisabledOptions) (bool, error)
	// Returns whether the element is [editable](./actionability.md#editable).
	IsEditable(selector string, options ...FrameIsEditableOptions) (bool, error)
	// Returns whether the element is [enabled](./actionability.md#enabled).
	IsEnabled(selector string, options ...FrameIsEnabledOptions) (bool, error)
	// Returns whether the element is hidden, the opposite of [visible](./actionability.md#visible).  `selector` that does not
	// match any elements is considered hidden.
	IsHidden(selector string, options ...FrameIsHiddenOptions) (bool, error)
	// Returns whether the element is [visible](./actionability.md#visible). `selector` that does not match any elements is
	// considered not visible.
	IsVisible(selector string, options ...FrameIsVisibleOptions) (bool, error)
	// The page's main frame. Page is guaranteed to have a main frame which persists during navigations.
	MainFrame() Frame
	// Returns the opener for popup pages and `null` for others. If the opener has been closed already the returns `null`.
	Opener() (Page, error)
	// Returns the PDF buffer.
	// > NOTE: Generating a pdf is currently only supported in Chromium headless.
	// `page.pdf()` generates a pdf of the page with `print` css media. To generate a pdf with `screen` media, call
	// Page.emulateMedia() before calling `page.pdf()`:
	// > NOTE: By default, `page.pdf()` generates a pdf with modified colors for printing. Use the
	// [`-webkit-print-color-adjust`](https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-print-color-adjust) property to
	// force rendering of exact colors.
	// The `width`, `height`, and `margin` options accept values labeled with units. Unlabeled values are treated as pixels.
	// A few examples:
	// - `page.pdf({width: 100})` - prints with width set to 100 pixels
	// - `page.pdf({width: '100px'})` - prints with width set to 100 pixels
	// - `page.pdf({width: '10cm'})` - prints with width set to 10 centimeters.
	// All possible units are:
	// - `px` - pixel
	// - `in` - inch
	// - `cm` - centimeter
	// - `mm` - millimeter
	// The `format` options are:
	// - `Letter`: 8.5in x 11in
	// - `Legal`: 8.5in x 14in
	// - `Tabloid`: 11in x 17in
	// - `Ledger`: 17in x 11in
	// - `A0`: 33.1in x 46.8in
	// - `A1`: 23.4in x 33.1in
	// - `A2`: 16.54in x 23.4in
	// - `A3`: 11.7in x 16.54in
	// - `A4`: 8.27in x 11.7in
	// - `A5`: 5.83in x 8.27in
	// - `A6`: 4.13in x 5.83in
	// > NOTE: `headerTemplate` and `footerTemplate` markup have the following limitations: > 1. Script tags inside templates
	// are not evaluated. > 2. Page styles are not visible inside templates.
	PDF(options ...PagePdfOptions) ([]byte, error)
	// Focuses the element, and then uses Keyboard.down`] and [`method: Keyboard.up().
	// `key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)
	// value or a single character to generate the text for. A superset of the `key` values can be found
	// [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:
	// `F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`,
	// `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.
	// Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.
	// Holding down `Shift` will type the text that corresponds to the `key` in the upper case.
	// If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective
	// texts.
	// Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When specified with the
	// modifier, modifier is pressed and being held while the subsequent key is being pressed.
	Press(selector, key string, options ...PagePressOptions) error
	// The method finds an element matching the specified selector within the page. If no elements match the selector, the
	// return value resolves to `null`. To wait for an element on the page, use Page.waitForSelector().
	// Shortcut for main frame's Frame.querySelector().
	QuerySelector(selector string) (ElementHandle, error)
	// The method finds all elements matching the specified selector within the page. If no elements match the selector, the
	// return value resolves to `[]`.
	// Shortcut for main frame's Frame.querySelectorAll().
	QuerySelectorAll(selector string) ([]ElementHandle, error)
	// Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
	// last redirect.
	Reload(options ...PageReloadOptions) (Response, error)
	// Routing provides the capability to modify network requests that are made by a page.
	// Once routing is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted.
	// > NOTE: The handler will only be called for the first url if the response is a redirect.
	// An example of a naive handler that aborts all image requests:
	// or the same snippet using a regex pattern instead:
	// It is possible to examine the request to decide the route action. For example, mocking all requests that contain some
	// post data, and leaving all other requests as is:
	// Page routes take precedence over browser context routes (set up with BrowserContext.route()) when request
	// matches both handlers.
	// To remove a route with its handler you can use Page.unroute().
	// > NOTE: Enabling routing disables http cache.
	Route(url interface{}, handler routeHandler) error
	// Returns the buffer with the captured screenshot.
	Screenshot(options ...PageScreenshotOptions) ([]byte, error)
	// This method waits for an element matching `selector`, waits for [actionability](./actionability.md) checks, waits until
	// all specified options are present in the `<select>` element and selects these options.
	// If the target element is not a `<select>` element, this method throws an error. However, if the element is inside the
	// `<label>` element that has an associated
	// [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be used instead.
	// Returns the array of option values that have been successfully selected.
	// Triggers a `change` and `input` event once all the provided options have been selected.
	// Shortcut for main frame's Frame.selectOption().
	SelectOption(selector string, values SelectOptionValues, options ...FrameSelectOptionOptions) ([]string, error)
	SetContent(content string, options ...PageSetContentOptions) error
	// This setting will change the default maximum navigation time for the following methods and related shortcuts:
	// - Page.goBack()
	// - Page.goForward()
	// - Page.goto()
	// - Page.reload()
	// - Page.setContent()
	// - Page.waitForNavigation()
	// - Page.waitForURL()
	// > NOTE: Page.setDefaultNavigationTimeout`] takes priority over [`method: Page.setDefaultTimeout(),
	// BrowserContext.setDefaultTimeout`] and [`method: BrowserContext.setDefaultNavigationTimeout().
	SetDefaultNavigationTimeout(timeout float64)
	// This setting will change the default maximum time for all the methods accepting `timeout` option.
	// > NOTE: Page.setDefaultNavigationTimeout`] takes priority over [`method: Page.setDefaultTimeout().
	SetDefaultTimeout(timeout float64)
	// The extra HTTP headers will be sent with every request the page initiates.
	// > NOTE: Page.setExtraHTTPHeaders() does not guarantee the order of headers in the outgoing requests.
	SetExtraHTTPHeaders(headers map[string]string) error
	// This method expects `selector` to point to an
	// [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
	// Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they
	// are resolved relative to the the current working directory. For empty array, clears the selected files.
	SetInputFiles(selector string, files []InputFile, options ...FrameSetInputFilesOptions) error
	// In the case of multiple pages in a single browser, each page can have its own viewport size. However,
	// Browser.newContext() allows to set viewport size (and more) for all pages in the context at once.
	// `page.setViewportSize` will resize the page. A lot of websites don't expect phones to change size, so you should set the
	// viewport size before navigating to the page.
	SetViewportSize(width, height int) error
	// This method taps an element matching `selector` by performing the following steps:
	// 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
	// 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
	// element is detached during the checks, the whole action is retried.
	// 1. Scroll the element into view if needed.
	// 1. Use [`property: Page.touchscreen`] to tap the center of the element, or the specified `position`.
	// 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
	// When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
	// zero timeout disables this.
	// > NOTE: Page.tap() requires that the `hasTouch` option of the browser context be set to true.
	// Shortcut for main frame's Frame.tap().
	Tap(selector string, options ...FrameTapOptions) error
	// Returns `element.textContent`.
	TextContent(selector string, options ...FrameTextContentOptions) (string, error)
	// Returns the page's title. Shortcut for main frame's Frame.title().
	Title() (string, error)
	// Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text. `page.type` can be used to send
	// fine-grained keyboard events. To fill values in form fields, use Page.fill().
	// To press a special key, like `Control` or `ArrowDown`, use Keyboard.press().
	// Shortcut for main frame's Frame.type().
	Type(selector, text string, options ...PageTypeOptions) error
	// Shortcut for main frame's Frame.url().
	URL() string
	// This method unchecks an element matching `selector` by performing the following steps:
	// 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
	// 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already
	// unchecked, this method returns immediately.
	// 1. Wait for [actionability](./actionability.md) checks on the matched element, unless `force` option is set. If the
	// element is detached during the checks, the whole action is retried.
	// 1. Scroll the element into view if needed.
	// 1. Use [`property: Page.mouse`] to click in the center of the element.
	// 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
	// 1. Ensure that the element is now unchecked. If not, this method throws.
	// When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`. Passing
	// zero timeout disables this.
	// Shortcut for main frame's Frame.uncheck().
	Uncheck(selector string, options ...FrameUncheckOptions) error
	// Removes a route created with Page.route(). When `handler` is not specified, removes all routes for the `url`.
	Unroute(url interface{}, handler ...routeHandler) error
	// Video object associated with this page.
	Video() Video
	ViewportSize() ViewportSize
	// Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy
	// value. Will throw an error if the page is closed before the event is fired. Returns the event data value.
	WaitForEvent(event string, predicate ...interface{}) interface{}
	// Returns when the `expression` returns a truthy value. It resolves to a JSHandle of the truthy value.
	// The Page.waitForFunction() can be used to observe viewport size change:
	// To pass an argument to the predicate of Page.waitForFunction() function:
	// Shortcut for main frame's Frame.waitForFunction().
	WaitForFunction(expression string, arg interface{}, options ...FrameWaitForFunctionOptions) (JSHandle, error)
	// Returns when the required load state has been reached.
	// This resolves when the page reaches a required load state, `load` by default. The navigation must have been committed
	// when this method is called. If current document has already reached the required state, resolves immediately.
	// Shortcut for main frame's Frame.waitForLoadState().
	WaitForLoadState(state ...string)
	// Waits for the main frame navigation and returns the main resource response. In case of multiple redirects, the
	// navigation will resolve with the response of the last redirect. In case of navigation to a different anchor or
	// navigation due to History API usage, the navigation will resolve with `null`.
	// This resolves when the page navigates to a new URL or reloads. It is useful for when you run code which will indirectly
	// cause the page to navigate. e.g. The click target has an `onclick` handler that triggers navigation from a `setTimeout`.
	// Consider this example:
	// > NOTE: Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is
	// considered a navigation.
	// Shortcut for main frame's Frame.waitForNavigation().
	WaitForNavigation(options ...PageWaitForNavigationOptions) (Response, error)
	// Waits for the matching request and returns it. See [waiting for event](./events.md#waiting-for-event) for more details
	// about events.
	WaitForRequest(url interface{}, options ...interface{}) Request
	// Returns the matched response. See [waiting for event](./events.md#waiting-for-event) for more details about events.
	WaitForResponse(url interface{}, options ...interface{}) Response
	// Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or
	// `detached`.
	// Wait for the `selector` to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If at
	// the moment of calling the method `selector` already satisfies the condition, the method will return immediately. If the
	// selector doesn't satisfy the condition for the `timeout` milliseconds, the function will throw.
	// This method works across navigations:
	WaitForSelector(selector string, options ...PageWaitForSelectorOptions) (ElementHandle, error)
	// Waits for the given `timeout` in milliseconds.
	// Note that `page.waitForTimeout()` should only be used for debugging. Tests using the timer in production are going to be
	// flaky. Use signals such as network events, selectors becoming visible and others instead.
	// Shortcut for main frame's Frame.waitForTimeout().
	WaitForTimeout(timeout float64)
	// This method returns all of the dedicated [WebWorkers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API)
	// associated with the page.
	// > NOTE: This does not contain ServiceWorkers
	Workers() []Worker
	DragAndDrop(source, target string, options ...FrameDragAndDropOptions) error
	// Pauses script execution. Playwright will stop executing the script and wait for the user to either press 'Resume' button
	// in the page overlay or to call `playwright.resume()` in the DevTools console.
	// User can inspect selectors or perform manual steps while paused. Resume will continue running the original script from
	// the place it was paused.
	// > NOTE: This method requires Playwright to be started in a headed mode, with a falsy `headless` value in the
	// BrowserType.launch().
	Pause() error
	// Returns `input.value` for the selected `<input>` or `<textarea>` or `<select>` element. Throws for non-input elements.
	InputValue(selector string, options ...FrameInputValueOptions) (string, error)
	// Waits for the main frame to navigate to the given URL.
	// Shortcut for main frame's Frame.waitForURL().
	WaitForURL(url string, options ...FrameWaitForURLOptions) error
}

Page provides methods to interact with a single tab in a `Browser`, or an [extension background page](https://developer.chrome.com/extensions/background_pages) in Chromium. One `Browser` instance might have multiple `Page` instances. This example creates a page, navigates it to a URL, and then saves a screenshot: The Page class emits various events (described below) which can be handled using any of Node's native [`EventEmitter`](https://nodejs.org/api/events.html#events_class_eventemitter) methods, such as `on`, `once` or `removeListener`. This example logs a message for a single page `load` event: To unsubscribe from events use the `removeListener` method:

type PageAddInitScriptOptions added in v0.1100.0

type PageAddInitScriptOptions struct {
	// Optional Script source to be evaluated in all pages in the browser context.
	Script *string `json:"script"`
	// Optional Script path to be evaluated in all pages in the browser context.
	Path *string `json:"path"`
}

type PageAddScriptTagOptions

type PageAddScriptTagOptions struct {
	// Raw JavaScript content to be injected into frame.
	Content *string `json:"content"`
	// Path to the JavaScript file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory.
	Path *string `json:"path"`
	// Script type. Use 'module' in order to load a Javascript ES6 module. See [script](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) for more details.
	Type *string `json:"type"`
	// URL of a script to be added.
	URL *string `json:"url"`
}

type PageAddStyleTagOptions

type PageAddStyleTagOptions struct {
	// Raw CSS content to be injected into frame.
	Content *string `json:"content"`
	// Path to the CSS file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory.
	Path *string `json:"path"`
	// URL of the `<link>` tag.
	URL *string `json:"url"`
}

type PageCheckOptions

type PageCheckOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *PageCheckOptionsPosition `json:"position"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type PageCheckOptionsPosition added in v0.1400.0

type PageCheckOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type PageClickOptions

type PageClickOptions struct {
	// Defaults to `left`.
	Button *MouseButton `json:"button"`
	// defaults to 1. See [UIEvent.detail].
	ClickCount *int `json:"clickCount"`
	// Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.
	Delay *float64 `json:"delay"`
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
	Modifiers []KeyboardModifier `json:"modifiers"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *PageClickOptionsPosition `json:"position"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type PageClickOptionsPosition added in v0.1100.0

type PageClickOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type PageClip added in v0.1100.0

type PageClip struct {
	// x-coordinate of top-left corner of clip area
	X *float64 `json:"x"`
	// y-coordinate of top-left corner of clip area
	Y *float64 `json:"y"`
	// width of clipping area
	Width *float64 `json:"width"`
	// height of clipping area
	Height *float64 `json:"height"`
}

type PageCloseOptions

type PageCloseOptions struct {
	// Defaults to `false`. Whether to run the [before unload](https://developer.mozilla.org/en-US/docs/Web/Events/beforeunload) page handlers.
	RunBeforeUnload *bool `json:"runBeforeUnload"`
}

type PageDblclickOptions

type PageDblclickOptions struct {
	// Defaults to `left`.
	Button *MouseButton `json:"button"`
	// Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.
	Delay *float64 `json:"delay"`
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
	Modifiers []KeyboardModifier `json:"modifiers"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *PageDblclickOptionsPosition `json:"position"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type PageDblclickOptionsPosition added in v0.1100.0

type PageDblclickOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type PageDispatchEventOptions

type PageDispatchEventOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type PageDragAndDropOptions added in v0.1400.0

type PageDragAndDropOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not specified, some visible point of the element is used.
	SourcePosition *PageDragAndDropOptionsSourcePosition `json:"sourcePosition"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Drops on the target element at this point relative to the top-left corner of the element's padding box. If not specified, some visible point of the element is used.
	TargetPosition *PageDragAndDropOptionsTargetPosition `json:"targetPosition"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type PageDragAndDropOptionsSourcePosition added in v0.1400.0

type PageDragAndDropOptionsSourcePosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type PageDragAndDropOptionsTargetPosition added in v0.1400.0

type PageDragAndDropOptionsTargetPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type PageEmulateMediaOptions

type PageEmulateMediaOptions struct {
	// Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. Passing `'Null'` disables color scheme emulation.
	ColorScheme *ColorScheme `json:"colorScheme"`
	// Changes the CSS media type of the page. The only allowed values are `'Screen'`, `'Print'` and `'Null'`. Passing `'Null'` disables CSS media emulation.
	Media *Media `json:"media"`
	// Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. Passing `null` disables reduced motion emulation.
	ReducedMotion *ReducedMotion `json:"reducedMotion"`
}

type PageEvalOnSelectorAllOptions added in v0.1100.0

type PageEvalOnSelectorAllOptions struct {
	// Optional argument to pass to `expression`.
	Arg interface{} `json:"arg"`
}

type PageEvalOnSelectorOptions added in v0.1100.0

type PageEvalOnSelectorOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
}

type PageEvaluateHandleOptions added in v0.1100.0

type PageEvaluateHandleOptions struct {
	// Optional argument to pass to `expression`.
	Arg interface{} `json:"arg"`
}

type PageEvaluateOptions added in v0.1100.0

type PageEvaluateOptions struct {
	// Optional argument to pass to `expression`.
	Arg interface{} `json:"arg"`
}

type PageExposeBindingOptions

type PageExposeBindingOptions struct {
	// Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is supported. When passing by value, multiple arguments are supported.
	Handle *bool `json:"handle"`
}

type PageFillOptions

type PageFillOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type PageFocusOptions

type PageFocusOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type PageFrameOptions added in v0.171.1

type PageFrameOptions struct {
	Name *string
	URL  interface{}
}

PageFrameOptions is the option struct for Page.Frame()

type PageGetAttributeOptions

type PageGetAttributeOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type PageGoBackOptions

type PageGoBackOptions struct {
	// Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultNavigationTimeout(), BrowserContext.SetDefaultTimeout(), Page.SetDefaultNavigationTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When to consider operation succeeded, defaults to `load`. Events can be either:
	// `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
	// `'load'` - consider operation to be finished when the `load` event is fired.
	// `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.
	WaitUntil *WaitUntilState `json:"waitUntil"`
}

type PageGoForwardOptions

type PageGoForwardOptions struct {
	// Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultNavigationTimeout(), BrowserContext.SetDefaultTimeout(), Page.SetDefaultNavigationTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When to consider operation succeeded, defaults to `load`. Events can be either:
	// `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
	// `'load'` - consider operation to be finished when the `load` event is fired.
	// `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.
	WaitUntil *WaitUntilState `json:"waitUntil"`
}

type PageGotoOptions

type PageGotoOptions struct {
	// Referer header value. If provided it will take preference over the referer header value set by Page.SetExtraHttpHeaders().
	Referer *string `json:"referer"`
	// Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultNavigationTimeout(), BrowserContext.SetDefaultTimeout(), Page.SetDefaultNavigationTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When to consider operation succeeded, defaults to `load`. Events can be either:
	// `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
	// `'load'` - consider operation to be finished when the `load` event is fired.
	// `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.
	WaitUntil *WaitUntilState `json:"waitUntil"`
}

type PageHoverOptions

type PageHoverOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
	Modifiers []KeyboardModifier `json:"modifiers"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *PageHoverOptionsPosition `json:"position"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type PageHoverOptionsPosition added in v0.1100.0

type PageHoverOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type PageInnerHTMLOptions

type PageInnerHTMLOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type PageInnerTextOptions

type PageInnerTextOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type PageInputValueOptions added in v0.1400.0

type PageInputValueOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type PageIsCheckedOptions added in v0.1100.0

type PageIsCheckedOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type PageIsDisabledOptions added in v0.1100.0

type PageIsDisabledOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type PageIsEditableOptions added in v0.1100.0

type PageIsEditableOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type PageIsEnabledOptions added in v0.1100.0

type PageIsEnabledOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type PageIsHiddenOptions added in v0.1100.0

type PageIsHiddenOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type PageIsVisibleOptions added in v0.1100.0

type PageIsVisibleOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type PageMargin added in v0.1400.0

type PageMargin struct {
	// Top margin, accepts values labeled with units. Defaults to `0`.
	Top *string `json:"top"`
	// Right margin, accepts values labeled with units. Defaults to `0`.
	Right *string `json:"right"`
	// Bottom margin, accepts values labeled with units. Defaults to `0`.
	Bottom *string `json:"bottom"`
	// Left margin, accepts values labeled with units. Defaults to `0`.
	Left *string `json:"left"`
}

type PagePdfOptions added in v0.1100.0

type PagePdfOptions struct {
	// Display header and footer. Defaults to `false`.
	DisplayHeaderFooter *bool `json:"displayHeaderFooter"`
	// HTML template for the print footer. Should use the same format as the `headerTemplate`.
	FooterTemplate *string `json:"footerTemplate"`
	// Paper format. If set, takes priority over `width` or `height` options. Defaults to 'Letter'.
	Format *string `json:"format"`
	// HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them:
	// `'date'` formatted print date
	// `'title'` document title
	// `'url'` document location
	// `'pageNumber'` current page number
	// `'totalPages'` total pages in the document
	HeaderTemplate *string `json:"headerTemplate"`
	// Paper height, accepts values labeled with units.
	Height *string `json:"height"`
	// Paper orientation. Defaults to `false`.
	Landscape *bool `json:"landscape"`
	// Paper margins, defaults to none.
	Margin *PagePdfOptionsMargin `json:"margin"`
	// Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.
	PageRanges *string `json:"pageRanges"`
	// The file path to save the PDF to. If `path` is a relative path, then it is resolved relative to the current working directory. If no path is provided, the PDF won't be saved to the disk.
	Path *string `json:"path"`
	// Give any CSS `@page` size declared in the page priority over what is declared in `width` and `height` or `format` options. Defaults to `false`, which will scale the content to fit the paper size.
	PreferCSSPageSize *bool `json:"preferCSSPageSize"`
	// Print background graphics. Defaults to `false`.
	PrintBackground *bool `json:"printBackground"`
	// Scale of the webpage rendering. Defaults to `1`. Scale amount must be between 0.1 and 2.
	Scale *float64 `json:"scale"`
	// Paper width, accepts values labeled with units.
	Width *string `json:"width"`
}

type PagePdfOptionsMargin added in v0.1400.0

type PagePdfOptionsMargin struct {
	// Top margin, accepts values labeled with units. Defaults to `0`.
	Top *string `json:"top"`
	// Right margin, accepts values labeled with units. Defaults to `0`.
	Right *string `json:"right"`
	// Bottom margin, accepts values labeled with units. Defaults to `0`.
	Bottom *string `json:"bottom"`
	// Left margin, accepts values labeled with units. Defaults to `0`.
	Left *string `json:"left"`
}

type PagePosition added in v0.1100.0

type PagePosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type PagePressOptions

type PagePressOptions struct {
	// Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
	Delay *float64 `json:"delay"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type PageQuerySelectorOptions added in v0.1400.0

type PageQuerySelectorOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
}

type PageReloadOptions

type PageReloadOptions struct {
	// Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultNavigationTimeout(), BrowserContext.SetDefaultTimeout(), Page.SetDefaultNavigationTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When to consider operation succeeded, defaults to `load`. Events can be either:
	// `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
	// `'load'` - consider operation to be finished when the `load` event is fired.
	// `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.
	WaitUntil *WaitUntilState `json:"waitUntil"`
}

type PageRouteOptions added in v0.1100.0

type PageRouteOptions struct {
	// handler function to route the request.
	Handler func(Route, Request) `json:"handler"`
}

type PageScreenshotOptions

type PageScreenshotOptions struct {
	// An object which specifies clipping of the resulting image. Should have the following fields:
	Clip *PageScreenshotOptionsClip `json:"clip"`
	// When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Defaults to `false`.
	FullPage *bool `json:"fullPage"`
	// Hides default white background and allows capturing screenshots with transparency. Not applicable to `jpeg` images. Defaults to `false`.
	OmitBackground *bool `json:"omitBackground"`
	// The file path to save the image to. The screenshot type will be inferred from file extension. If `path` is a relative path, then it is resolved relative to the current working directory. If no path is provided, the image won't be saved to the disk.
	Path *string `json:"path"`
	// The quality of the image, between 0-100. Not applicable to `png` images.
	Quality *int `json:"quality"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// Specify screenshot type, defaults to `png`.
	Type *ScreenshotType `json:"type"`
}

type PageScreenshotOptionsClip added in v0.1100.0

type PageScreenshotOptionsClip struct {
	// x-coordinate of top-left corner of clip area
	X *float64 `json:"x"`
	// y-coordinate of top-left corner of clip area
	Y *float64 `json:"y"`
	// width of clipping area
	Width *float64 `json:"width"`
	// height of clipping area
	Height *float64 `json:"height"`
}

type PageSelectOptionOptions

type PageSelectOptionOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type PageSetContentOptions

type PageSetContentOptions struct {
	// Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultNavigationTimeout(), BrowserContext.SetDefaultTimeout(), Page.SetDefaultNavigationTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When to consider operation succeeded, defaults to `load`. Events can be either:
	// `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
	// `'load'` - consider operation to be finished when the `load` event is fired.
	// `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.
	WaitUntil *WaitUntilState `json:"waitUntil"`
}

type PageSetInputFilesOptions

type PageSetInputFilesOptions struct {
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type PageSourcePosition added in v0.1400.0

type PageSourcePosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type PageTapOptions

type PageTapOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
	Modifiers []KeyboardModifier `json:"modifiers"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *PageTapOptionsPosition `json:"position"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type PageTapOptionsPosition added in v0.1100.0

type PageTapOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type PageTargetPosition added in v0.1400.0

type PageTargetPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type PageTextContentOptions

type PageTextContentOptions struct {
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type PageTypeOptions

type PageTypeOptions struct {
	// Time to wait between key presses in milliseconds. Defaults to 0.
	Delay *float64 `json:"delay"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type PageUncheckOptions

type PageUncheckOptions struct {
	// Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
	Force *bool `json:"force"`
	// Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`.
	NoWaitAfter *bool `json:"noWaitAfter"`
	// A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
	Position *PageUncheckOptionsPosition `json:"position"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
	Trial *bool `json:"trial"`
}

type PageUncheckOptionsPosition added in v0.1400.0

type PageUncheckOptionsPosition struct {
	X *float64 `json:"x"`
	Y *float64 `json:"y"`
}

type PageUnrouteOptions added in v0.1100.0

type PageUnrouteOptions struct {
	// Optional handler function to route the request.
	Handler func(Route, Request) `json:"handler"`
}

type PageViewportSizeResult added in v0.1100.0

type PageViewportSizeResult struct {
	// page width in pixels.
	Width *int `json:"width"`
	// page height in pixels.
	Height *int `json:"height"`
}

Result of calling <see cref="Page.ViewportSize" />.

type PageWaitForFunctionOptions

type PageWaitForFunctionOptions struct {
	// If `polling` is `'raf'`, then `expression` is constantly executed in `requestAnimationFrame` callback. If `polling` is a number, then it is treated as an interval in milliseconds at which the function would be executed. Defaults to `raf`.
	Polling interface{} `json:"polling"`
	// maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout().
	Timeout *float64 `json:"timeout"`
}

type PageWaitForLoadStateOptions

type PageWaitForLoadStateOptions struct {
	// Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultNavigationTimeout(), BrowserContext.SetDefaultTimeout(), Page.SetDefaultNavigationTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type PageWaitForNavigationOptions

type PageWaitForNavigationOptions struct {
	// Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultNavigationTimeout(), BrowserContext.SetDefaultTimeout(), Page.SetDefaultNavigationTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation.
	URL interface{} `json:"url"`
	// When to consider operation succeeded, defaults to `load`. Events can be either:
	// `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
	// `'load'` - consider operation to be finished when the `load` event is fired.
	// `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.
	WaitUntil *WaitUntilState `json:"waitUntil"`
}

type PageWaitForRequestOptions

type PageWaitForRequestOptions struct {
	// Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be changed by using the Page.SetDefaultTimeout() method.
	Timeout *float64 `json:"timeout"`
}

type PageWaitForResponseOptions

type PageWaitForResponseOptions struct {
	// Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type PageWaitForSelectorOptions

type PageWaitForSelectorOptions struct {
	// Defaults to `'visible'`. Can be either:
	// `'attached'` - wait for element to be present in DOM.
	// `'detached'` - wait for element to not be present in DOM.
	// `'visible'` - wait for element to have non-empty bounding box and no `visibility:hidden`. Note that element without any content or with `display:none` has an empty bounding box and is not considered visible.
	// `'hidden'` - wait for element to be either detached from DOM, or have an empty bounding box or `visibility:hidden`. This is opposite to the `'visible'` option.
	State *WaitForSelectorState `json:"state"`
	// When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception.
	Strict *bool `json:"strict"`
	// Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
}

type PageWaitForURLOptions added in v0.1400.0

type PageWaitForURLOptions struct {
	// Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the BrowserContext.SetDefaultNavigationTimeout(), BrowserContext.SetDefaultTimeout(), Page.SetDefaultNavigationTimeout() or Page.SetDefaultTimeout() methods.
	Timeout *float64 `json:"timeout"`
	// When to consider operation succeeded, defaults to `load`. Events can be either:
	// `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
	// `'load'` - consider operation to be finished when the `load` event is fired.
	// `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.
	WaitUntil *WaitUntilState `json:"waitUntil"`
}

type Playwright

type Playwright struct {
	Chromium BrowserType
	Firefox  BrowserType
	WebKit   BrowserType
	Devices  map[string]*DeviceDescriptor
	// contains filtered or unexported fields
}

Playwright represents a Playwright instance

func Run

func Run(options ...*RunOptions) (*Playwright, error)

Run starts a Playwright instance

func (*Playwright) Stop

func (p *Playwright) Stop() error

Stop stops the Playwright instance

type PlaywrightDriver added in v0.1400.0

type PlaywrightDriver struct {
	DriverDirectory, DriverBinaryLocation, Version string
	// contains filtered or unexported fields
}

func NewDriver added in v0.1400.0

func NewDriver(options *RunOptions) (*PlaywrightDriver, error)

func (*PlaywrightDriver) DownloadDriver added in v0.1400.0

func (d *PlaywrightDriver) DownloadDriver() error

type Rect

type Rect struct {
	Width  int `json:"width"`
	Height int `json:"height"`
	X      int `json:"x"`
	Y      int `json:"y"`
}

Rect is the return structure for ElementHandle.BoundingBox()

type ReducedMotion added in v0.1400.0

type ReducedMotion string
var (
	ReducedMotionReduce       *ReducedMotion = getReducedMotion("reduce")
	ReducedMotionNoPreference                = getReducedMotion("no-preference")
)

type Request

type Request interface {
	// The method returns `null` unless this request has failed, as reported by `requestfailed` event.
	// Example of logging of all the failed requests:
	Failure() *RequestFailure
	// Returns the `Frame` that initiated this request.
	Frame() Frame
	// An object with HTTP headers associated with the request. All header names are lower-case.
	Headers() map[string]string
	// Whether this request is driving frame's navigation.
	IsNavigationRequest() bool
	// Request's method (GET, POST, etc.)
	Method() string
	// Request's post body, if any.
	PostData() (string, error)
	// Request's post body in a binary form, if any.
	PostDataBuffer() ([]byte, error)
	// Returns parsed request's body for `form-urlencoded` and JSON as a fallback if any.
	// When the response is `application/x-www-form-urlencoded` then a key/value object of the values will be returned.
	// Otherwise it will be parsed as JSON.
	PostDataJSON(v interface{}) error
	// Request that was redirected by the server to this one, if any.
	// When the server responds with a redirect, Playwright creates a new `Request` object. The two requests are connected by
	// `redirectedFrom()` and `redirectedTo()` methods. When multiple server redirects has happened, it is possible to
	// construct the whole redirect chain by repeatedly calling `redirectedFrom()`.
	// For example, if the website `http://example.com` redirects to `https://example.com`:
	// If the website `https://google.com` has no redirects:
	RedirectedFrom() Request
	// New request issued by the browser if the server responded with redirect.
	// This method is the opposite of Request.redirectedFrom():
	RedirectedTo() Request
	// Contains the request's resource type as it was perceived by the rendering engine. ResourceType will be one of the
	// following: `document`, `stylesheet`, `image`, `media`, `font`, `script`, `texttrack`, `xhr`, `fetch`, `eventsource`,
	// `websocket`, `manifest`, `other`.
	ResourceType() string
	// Returns the matching `Response` object, or `null` if the response was not received due to error.
	Response() (Response, error)
	// Returns resource timing information for given request. Most of the timing values become available upon the response,
	// `responseEnd` becomes available when request finishes. Find more information at
	// [Resource Timing API](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming).
	Timing() *ResourceTiming
	// URL of the request.
	URL() string
}

Whenever the page sends a request for a network resource the following sequence of events are emitted by `Page`: - [`event: Page.request`] emitted when the request is issued by the page. - [`event: Page.response`] emitted when/if the response status and headers are received for the request. - [`event: Page.requestFinished`] emitted when the response body is downloaded and the request is complete. If request fails at some point, then instead of `'requestfinished'` event (and possibly instead of 'response' event), the [`event: Page.requestFailed`] event is emitted. > NOTE: HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with `'requestfinished'` event. If request gets a 'redirect' response, the request is successfully finished with the 'requestfinished' event, and a new request is issued to a redirected url.

type RequestFailure

type RequestFailure struct {
	ErrorText string
}

RequestFailure represents a request failure

type RequestTimingResult added in v0.1100.0

type RequestTimingResult struct {
	// Request start time in milliseconds elapsed since January 1, 1970 00:00:00 UTC
	StartTime *float64 `json:"startTime"`
	// Time immediately before the browser starts the domain name lookup for the resource. The value is given in milliseconds relative to `startTime`, -1 if not available.
	DomainLookupStart *float64 `json:"domainLookupStart"`
	// Time immediately after the browser starts the domain name lookup for the resource. The value is given in milliseconds relative to `startTime`, -1 if not available.
	DomainLookupEnd *float64 `json:"domainLookupEnd"`
	// Time immediately before the user agent starts establishing the connection to the server to retrieve the resource. The value is given in milliseconds relative to `startTime`, -1 if not available.
	ConnectStart *float64 `json:"connectStart"`
	// Time immediately before the browser starts the handshake process to secure the current connection. The value is given in milliseconds relative to `startTime`, -1 if not available.
	SecureConnectionStart *float64 `json:"secureConnectionStart"`
	// Time immediately before the user agent starts establishing the connection to the server to retrieve the resource. The value is given in milliseconds relative to `startTime`, -1 if not available.
	ConnectEnd *float64 `json:"connectEnd"`
	// Time immediately before the browser starts requesting the resource from the server, cache, or local resource. The value is given in milliseconds relative to `startTime`, -1 if not available.
	RequestStart *float64 `json:"requestStart"`
	// Time immediately after the browser starts requesting the resource from the server, cache, or local resource. The value is given in milliseconds relative to `startTime`, -1 if not available.
	ResponseStart *float64 `json:"responseStart"`
	// Time immediately after the browser receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first. The value is given in milliseconds relative to `startTime`, -1 if not available.
	ResponseEnd *float64 `json:"responseEnd"`
}

Result of calling <see cref="Request.Timing" />.

type ResourceTiming added in v0.171.1

type ResourceTiming struct {
	StartTime             float64
	DomainLookupStart     float64
	DomainLookupEnd       float64
	ConnectStart          float64
	SecureConnectionStart float64
	ConnectEnd            float64
	RequestStart          float64
	ResponseStart         float64
	ResponseEnd           float64
}

ResourceTiming represents the resource timing

type Response

type Response interface {
	// Returns the buffer with response body.
	Body() ([]byte, error)
	// Waits for this response to finish, returns failure error if request failed.
	Finished() error
	// Returns the `Frame` that initiated this response.
	Frame() Frame
	// Returns the object with HTTP headers associated with the response. All header names are lower-case.
	Headers() map[string]string
	// Returns the JSON representation of response body.
	// This method will throw if the response body is not parsable via `JSON.parse`.
	JSON(v interface{}) error
	// Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
	Ok() bool
	// Returns the matching `Request` object.
	Request() Request
	// Contains the status code of the response (e.g., 200 for a success).
	Status() int
	// Contains the status text of the response (e.g. usually an "OK" for a success).
	StatusText() string
	// Returns the text representation of response body.
	Text() (string, error)
	// Contains the URL of the response.
	URL() string
}

`Response` class represents responses which are received by page.

type ResponseSecurityDetailsResult added in v0.1400.0

type ResponseSecurityDetailsResult struct {
	// Common Name component of the Issuer field. from the certificate. This should only be used for informational purposes. Optional.
	Issuer *string `json:"issuer"`
	// The specific TLS protocol used. (e.g. `TLS 1.3`). Optional.
	Protocol *string `json:"protocol"`
	// Common Name component of the Subject field from the certificate. This should only be used for informational purposes. Optional.
	SubjectName *string `json:"subjectName"`
	// Unix timestamp (in seconds) specifying when this cert becomes valid. Optional.
	ValidFrom *float64 `json:"validFrom"`
	// Unix timestamp (in seconds) specifying when this cert becomes invalid. Optional.
	ValidTo *float64 `json:"validTo"`
}

Result of calling <see cref="Response.SecurityDetails" />.

type ResponseServerAddrResult added in v0.1400.0

type ResponseServerAddrResult struct {
	// IPv4 or IPV6 address of the server.
	IpAddress *string `json:"ipAddress"`
	Port      *int    `json:"port"`
}

Result of calling <see cref="Response.ServerAddr" />.

type Route

type Route interface {
	// Aborts the route's request.
	Abort(errorCode ...string) error
	// Continues route's request with optional overrides.
	Continue(options ...RouteContinueOptions) error
	// Fulfills route's request with given response.
	// An example of fulfilling all requests with 404 responses:
	// An example of serving static file:
	Fulfill(options RouteFulfillOptions) error
	// A request to be routed.
	Request() Request
}

Whenever a network route is set up with Page.route`] or [`method: BrowserContext.route(), the `Route` object allows to handle the route.

type RouteAbortOptions added in v0.171.1

type RouteAbortOptions struct {
	// Optional error code. Defaults to `failed`, could be one of the following:
	// `'aborted'` - An operation was aborted (due to user action)
	// `'accessdenied'` - Permission to access a resource, other than the network, was denied
	// `'addressunreachable'` - The IP address is unreachable. This usually means that there is no route to the specified host or network.
	// `'blockedbyclient'` - The client chose to block the request.
	// `'blockedbyresponse'` - The request failed because the response was delivered along with requirements which are not met ('X-Frame-Options' and 'Content-Security-Policy' ancestor checks, for instance).
	// `'connectionaborted'` - A connection timed out as a result of not receiving an ACK for data sent.
	// `'connectionclosed'` - A connection was closed (corresponding to a TCP FIN).
	// `'connectionfailed'` - A connection attempt failed.
	// `'connectionrefused'` - A connection attempt was refused.
	// `'connectionreset'` - A connection was reset (corresponding to a TCP RST).
	// `'internetdisconnected'` - The Internet connection has been lost.
	// `'namenotresolved'` - The host name could not be resolved.
	// `'timedout'` - An operation timed out.
	// `'failed'` - A generic failure occurred.
	ErrorCode *string `json:"errorCode"`
}

type RouteContinueOptions

type RouteContinueOptions struct {
	// If set changes the request HTTP headers. Header values will be converted to a string.
	Headers map[string]string `json:"headers"`
	// If set changes the request method (e.g. GET or POST)
	Method *string `json:"method"`
	// If set changes the post data of request
	PostData interface{} `json:"postData"`
	// If set changes the request URL. New URL must have same protocol as original one.
	URL *string `json:"url"`
}

type RouteFulfillOptions

type RouteFulfillOptions struct {
	// Response body.
	Body interface{} `json:"body"`
	// If set, equals to setting `Content-Type` response header.
	ContentType *string `json:"contentType"`
	// Response headers. Header values will be converted to a string.
	Headers map[string]string `json:"headers"`
	// File path to respond with. The content type will be inferred from file extension. If `path` is a relative path, then it is resolved relative to the current working directory.
	Path *string `json:"path"`
	// Response status code, defaults to `200`.
	Status *int `json:"status"`
}

type RunOptions

type RunOptions struct {
	DriverDirectory     string
	SkipInstallBrowsers bool
	Browsers            []string
}

RunOptions are custom options to run the driver

type SameSiteAttribute added in v0.1100.0

type SameSiteAttribute string

type ScreenshotType added in v0.1100.0

type ScreenshotType string
var (
	ScreenshotTypePng  *ScreenshotType = getScreenshotType("png")
	ScreenshotTypeJpeg                 = getScreenshotType("jpeg")
)

type SelectOptionValues added in v0.1100.0

type SelectOptionValues struct {
	Values   *[]string
	Indexes  *[]int
	Labels   *[]string
	Elements *[]ElementHandle
}

SelectOptionValues is the option struct for ElementHandle.Select() etc.

type SelectorsRegisterOptions

type SelectorsRegisterOptions struct {
	// Whether to run this selector engine in isolated JavaScript environment. This environment has access to the same DOM, but not any JavaScript objects from the frame's scripts. Defaults to `false`. Note that running as a content script is not guaranteed when this engine is used together with other registered engines.
	ContentScript *bool `json:"contentScript"`
}

type SetGeolocationOptions

type SetGeolocationOptions struct {
	Longitude int  `json:"longitude"`
	Latitude  int  `json:"latitude"`
	Accuracy  *int `json:"accuracy"`
}

SetGeolocationOptions represents the options for BrowserContext.SetGeolocation()

type SetNetworkCookieParam

type SetNetworkCookieParam struct {
	Name     string  `json:"name"`
	Value    string  `json:"value"`
	URL      *string `json:"url"`
	Domain   *string `json:"domain"`
	Path     *string `json:"path"`
	Expires  *int    `json:"expires"`
	HttpOnly *bool   `json:"httpOnly"`
	Secure   *bool   `json:"secure"`
	SameSite *string `json:"sameSite"`
}

SetNetworkCookieParam is used to filter cookies in BrowserContext.AddCookies()

type StorageState added in v0.1100.0

type StorageState struct {
	Cookies []Cookie       `json:"cookies"`
	Origins []OriginsState `json:"origins"`
}

type TimeoutError

type TimeoutError Error

TimeoutError represents a Playwright TimeoutError

func (*TimeoutError) Error

func (e *TimeoutError) Error() string

type Touchscreen added in v0.171.1

type Touchscreen interface {
	// Dispatches a `touchstart` and `touchend` event with a single touch at the position (`x`,`y`).
	Tap(x int, y int) error
}

The Touchscreen class operates in main-frame CSS pixels relative to the top-left corner of the viewport. Methods on the touchscreen can only be used in browser contexts that have been initialized with `hasTouch` set to true.

type Tracing added in v0.1400.0

type Tracing interface {
	// Start tracing.
	Start(options ...TracingStartOptions) error
	// Stop tracing.
	Stop(options ...TracingStopOptions) error
}

API for collecting and saving Playwright traces. Playwright traces can be opened using the Playwright CLI after Playwright script runs. Start with specifying the folder traces will be stored in:

type TracingStartOptions added in v0.1400.0

type TracingStartOptions struct {
	// If specified, the trace is going to be saved into the file with the given name inside the `tracesDir` folder specified in BrowserType.Launch().
	Name *string `json:"name"`
	// Whether to capture screenshots during tracing. Screenshots are used to build a timeline preview.
	Screenshots *bool `json:"screenshots"`
	// Whether to capture DOM snapshot on every action.
	Snapshots *bool `json:"snapshots"`
}

type TracingStopOptions added in v0.1400.0

type TracingStopOptions struct {
	// Export trace into the file with the given name.
	Path *string `json:"path"`
}

type Video

type Video interface {
	// Returns the file system path this video will be recorded to. The video is guaranteed to be written to the filesystem
	// upon closing the browser context. This method throws when connected remotely.
	Path() string
	// Deletes the video file. Will wait for the video to finish if necessary.
	Delete() error
	// Saves the video to a user-specified path. It is safe to call this method while the video is still in progress, or after
	// the page has closed. This method waits until the page is closed and the video is fully saved.
	SaveAs(path string) error
}

When browser context is created with the `recordVideo` option, each page has a video object associated with it.

type ViewportSize

type ViewportSize struct {
	Width  int `json:"width"`
	Height int `json:"height"`
}

ViewportSize represents the viewport size

type WaitForSelectorState added in v0.1100.0

type WaitForSelectorState string

type WaitUntilState added in v0.1100.0

type WaitUntilState string

type WebSocket

type WebSocket interface {
	EventEmitter
	// Indicates that the web socket has been closed.
	IsClosed() bool
	// Contains the URL of the WebSocket.
	URL() string
	// Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy
	// value. Will throw an error if the webSocket is closed before the event is fired. Returns the event data value.
	WaitForEvent(event string, predicate ...interface{}) interface{}
}

The `WebSocket` class represents websocket connections in the page.

type Worker

type Worker interface {
	EventEmitter
	// Returns the return value of `expression`.
	// If the function passed to the Worker.evaluate`] returns a [Promise], then [`method: Worker.evaluate() would
	// wait for the promise to resolve and return its value.
	// If the function passed to the Worker.evaluate() returns a non-[Serializable] value, then
	// Worker.evaluate() returns `undefined`. Playwright also supports transferring some additional values that are
	// not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`.
	Evaluate(expression string, options ...interface{}) (interface{}, error)
	// Returns the return value of `expression` as a `JSHandle`.
	// The only difference between Worker.evaluate`] and [`method: Worker.evaluateHandle() is that
	// Worker.evaluateHandle() returns `JSHandle`.
	// If the function passed to the Worker.evaluateHandle() returns a [Promise], then
	// Worker.evaluateHandle() would wait for the promise to resolve and return its value.
	EvaluateHandle(expression string, options ...interface{}) (JSHandle, error)
	URL() string
	WaitForEvent(event string, predicate ...interface{}) interface{}
	ExpectEvent(event string, cb func() error, predicates ...interface{}) (interface{}, error)
}

The Worker class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). `worker` event is emitted on the page object to signal a worker creation. `close` event is emitted on the worker object when the worker is gone.

type WorkerEvaluateHandleOptions added in v0.1100.0

type WorkerEvaluateHandleOptions struct {
	// Optional argument to pass to `expression`.
	Arg interface{} `json:"arg"`
}

type WorkerEvaluateOptions added in v0.1100.0

type WorkerEvaluateOptions struct {
	// Optional argument to pass to `expression`.
	Arg interface{} `json:"arg"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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