Class BrowserType.LaunchPersistentContextOptions

  • Enclosing interface:
    BrowserType

    public static class BrowserType.LaunchPersistentContextOptions
    extends java.lang.Object
    • Field Detail

      • acceptDownloads

        public java.lang.Boolean acceptDownloads
        Whether to automatically download all the attachments. Defaults to true where all the downloads are accepted.
      • args

        public java.util.List<java.lang.String> args
        Additional arguments to pass to the browser instance. The list of Chromium flags can be found here.
      • baseURL

        public java.lang.String baseURL
        When using Page.navigate(), Page.route(), Page.waitForURL(), Page.waitForRequest(), or Page.waitForResponse() it takes the base URL in consideration by using the URL() constructor for building the corresponding URL. Unset by default. 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: http://localhost:3000/foo (without trailing slash) and navigating to ./bar.html results in http://localhost:3000/bar.html
      • bypassCSP

        public java.lang.Boolean bypassCSP
        Toggles bypassing page's Content-Security-Policy. Defaults to false.
      • channel

        public java.lang.Object channel
        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.
      • chromiumSandbox

        public java.lang.Boolean chromiumSandbox
        Enable Chromium sandboxing. Defaults to false.
      • colorScheme

        public java.util.Optional<ColorScheme> colorScheme
        Emulates "prefers-colors-scheme" media feature, supported values are "light", "dark", "no-preference". See Page.emulateMedia() for more details. Passing null resets emulation to system defaults. Defaults to "light".
      • devtools

        public java.lang.Boolean devtools
        **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.
      • downloadsPath

        public java.nio.file.Path downloadsPath
        If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and is deleted when browser is closed. In either case, the downloads are deleted when the browser context they were created in is closed.
      • env

        public java.util.Map<java.lang.String,​java.lang.String> env
        Specify environment variables that will be visible to the browser. Defaults to process.env.
      • executablePath

        public java.nio.file.Path executablePath
        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.
      • extraHTTPHeaders

        public java.util.Map<java.lang.String,​java.lang.String> extraHTTPHeaders
        An object containing additional HTTP headers to be sent with every request. Defaults to none.
      • forcedColors

        public java.util.Optional<ForcedColors> forcedColors
        Emulates "forced-colors" media feature, supported values are "active", "none". See Page.emulateMedia() for more details. Passing null resets emulation to system defaults. Defaults to "none".
      • handleSIGHUP

        public java.lang.Boolean handleSIGHUP
        Close the browser process on SIGHUP. Defaults to true.
      • handleSIGINT

        public java.lang.Boolean handleSIGINT
        Close the browser process on Ctrl-C. Defaults to true.
      • handleSIGTERM

        public java.lang.Boolean handleSIGTERM
        Close the browser process on SIGTERM. Defaults to true.
      • hasTouch

        public java.lang.Boolean hasTouch
        Specifies if viewport supports touch events. Defaults to false. Learn more about mobile emulation.
      • headless

        public java.lang.Boolean headless
        Whether to run browser in headless mode. More details for Chromium and Firefox. Defaults to true unless the devtools option is true.
      • httpCredentials

        public HttpCredentials httpCredentials
        Credentials for HTTP authentication. If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
      • ignoreAllDefaultArgs

        public java.lang.Boolean ignoreAllDefaultArgs
        If true, Playwright does not pass its own configurations args and only uses the ones from args. Dangerous option; use with care. Defaults to false.
      • ignoreDefaultArgs

        public java.util.List<java.lang.String> ignoreDefaultArgs
        If true, Playwright does not pass its own configurations args and only uses the ones from args. Dangerous option; use with care.
      • ignoreHTTPSErrors

        public java.lang.Boolean ignoreHTTPSErrors
        Whether to ignore HTTPS errors when sending network requests. Defaults to false.
      • isMobile

        public java.lang.Boolean isMobile
        Whether the meta viewport tag is taken into account and touch events are enabled. isMobile is a part of device, so you don't actually need to set it manually. Defaults to false and is not supported in Firefox. Learn more about mobile emulation.
      • javaScriptEnabled

        public java.lang.Boolean javaScriptEnabled
        Whether or not to enable JavaScript in the context. Defaults to true. Learn more about disabling JavaScript.
      • locale

        public java.lang.String locale
        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. Defaults to the system default locale. Learn more about emulation in our emulation guide.
      • offline

        public java.lang.Boolean offline
        Whether to emulate network being offline. Defaults to false. Learn more about network emulation.
      • permissions

        public java.util.List<java.lang.String> permissions
        A list of permissions to grant to all pages in this context. See BrowserContext.grantPermissions() for more details. Defaults to none.
      • proxy

        public Proxy proxy
        Network proxy settings.
      • recordHarContent

        public HarContentPolicy recordHarContent
        Optional setting to control resource content management. If omit is specified, content is not persisted. If attach is specified, resources are persisted as separate files and all of these files are archived along with the HAR file. Defaults to embed, which stores content inline the HAR file as per HAR specification.
      • recordHarMode

        public HarMode recordHarMode
        When set to minimal, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to full.
      • recordHarOmitContent

        public java.lang.Boolean recordHarOmitContent
        Optional setting to control whether to omit request content from the HAR. Defaults to false.
      • recordHarPath

        public java.nio.file.Path recordHarPath
        Enables HAR recording for all pages into the specified HAR file on the filesystem. If not specified, the HAR is not recorded. Make sure to call BrowserContext.close() for the HAR to be saved.
      • recordHarUrlFilter

        public java.lang.Object recordHarUrlFilter
      • recordVideoDir

        public java.nio.file.Path recordVideoDir
        Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure to call BrowserContext.close() for videos to be saved.
      • recordVideoSize

        public RecordVideoSize recordVideoSize
        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.
      • reducedMotion

        public java.util.Optional<ReducedMotion> reducedMotion
        Emulates "prefers-reduced-motion" media feature, supported values are "reduce", "no-preference". See Page.emulateMedia() for more details. Passing null resets emulation to system defaults. Defaults to "no-preference".
      • screenSize

        public ScreenSize screenSize
        Emulates consistent window screen size available inside web page via window.screen. Is only used when the viewport is set.
      • serviceWorkers

        public ServiceWorkerPolicy serviceWorkers
        Whether to allow sites to register Service workers. Defaults to "allow".
        • "allow": Service Workers can be registered.
        • "block": Playwright will block all registration of Service Workers.
      • slowMo

        public java.lang.Double slowMo
        Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on.
      • strictSelectors

        public java.lang.Boolean strictSelectors
        If set to true, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors that imply single target DOM element will throw when more than one element matches the selector. This option does not affect any Locator APIs (Locators are always strict). Defaults to false. See Locator to learn more about the strict mode.
      • timeout

        public java.lang.Double timeout
        Maximum time in milliseconds to wait for the browser instance to start. Defaults to 30000 (30 seconds). Pass 0 to disable timeout.
      • timezoneId

        public java.lang.String timezoneId
        Changes the timezone of the context. See ICU's metaZones.txt for a list of supported timezone IDs. Defaults to the system timezone.
      • tracesDir

        public java.nio.file.Path tracesDir
        If specified, traces are saved into this directory.
      • userAgent

        public java.lang.String userAgent
        Specific user agent to use in this context.
      • viewportSize

        public java.util.Optional<ViewportSize> viewportSize
        Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use null to disable the consistent viewport emulation. Learn more about viewport emulation.

        NOTE: The null value opts out from the default presets, makes viewport depend on the host window size defined by the operating system. It makes the execution of the tests non-deterministic.

    • Constructor Detail

      • LaunchPersistentContextOptions

        public LaunchPersistentContextOptions()