Class BrowserType.LaunchOptions

  • Enclosing interface:
    BrowserType

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

      • 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.
      • 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.
      • 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.
      • firefoxUserPrefs

        public java.util.Map<java.lang.String,​java.lang.Object> firefoxUserPrefs
        Firefox user preferences. Learn more about the Firefox user preferences at about:config.
      • 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.
      • 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.
      • 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.
      • proxy

        public Proxy proxy
        Network proxy settings.
      • 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.
      • 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.
      • tracesDir

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

      • LaunchOptions

        public LaunchOptions()
    • Method Detail

      • setArgs

        public BrowserType.LaunchOptions setArgs​(java.util.List<java.lang.String> args)
        Additional arguments to pass to the browser instance. The list of Chromium flags can be found here.
      • setChannel

        public BrowserType.LaunchOptions setChannel​(java.lang.String 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.
      • setChromiumSandbox

        public BrowserType.LaunchOptions setChromiumSandbox​(boolean chromiumSandbox)
        Enable Chromium sandboxing. Defaults to false.
      • setDevtools

        public BrowserType.LaunchOptions setDevtools​(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.
      • setDownloadsPath

        public BrowserType.LaunchOptions setDownloadsPath​(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.
      • setEnv

        public BrowserType.LaunchOptions setEnv​(java.util.Map<java.lang.String,​java.lang.String> env)
        Specify environment variables that will be visible to the browser. Defaults to process.env.
      • setExecutablePath

        public BrowserType.LaunchOptions setExecutablePath​(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.
      • setFirefoxUserPrefs

        public BrowserType.LaunchOptions setFirefoxUserPrefs​(java.util.Map<java.lang.String,​java.lang.Object> firefoxUserPrefs)
        Firefox user preferences. Learn more about the Firefox user preferences at about:config.
      • setHandleSIGHUP

        public BrowserType.LaunchOptions setHandleSIGHUP​(boolean handleSIGHUP)
        Close the browser process on SIGHUP. Defaults to true.
      • setHandleSIGINT

        public BrowserType.LaunchOptions setHandleSIGINT​(boolean handleSIGINT)
        Close the browser process on Ctrl-C. Defaults to true.
      • setHandleSIGTERM

        public BrowserType.LaunchOptions setHandleSIGTERM​(boolean handleSIGTERM)
        Close the browser process on SIGTERM. Defaults to true.
      • setHeadless

        public BrowserType.LaunchOptions setHeadless​(boolean headless)
        Whether to run browser in headless mode. More details for Chromium and Firefox. Defaults to true unless the devtools option is true.
      • setIgnoreAllDefaultArgs

        public BrowserType.LaunchOptions setIgnoreAllDefaultArgs​(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.
      • setIgnoreDefaultArgs

        public BrowserType.LaunchOptions setIgnoreDefaultArgs​(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.
      • setSlowMo

        public BrowserType.LaunchOptions setSlowMo​(double slowMo)
        Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on.
      • setTimeout

        public BrowserType.LaunchOptions setTimeout​(double timeout)
        Maximum time in milliseconds to wait for the browser instance to start. Defaults to 30000 (30 seconds). Pass 0 to disable timeout.
      • setTracesDir

        public BrowserType.LaunchOptions setTracesDir​(java.nio.file.Path tracesDir)
        If specified, traces are saved into this directory.