Class BrowserType.LaunchOptions

  • Enclosing interface:
    BrowserType

    public static class BrowserType.LaunchOptions
    extends Object
    • Field Detail

      • args

        public List<String> args
        NOTE: Use custom browser args at your own risk, as some of them may break Playwright functionality.

        Additional arguments to pass to the browser instance. The list of Chromium flags can be found here.

      • channel

        public 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 Boolean chromiumSandbox
        Enable Chromium sandboxing. Defaults to false.
      • downloadsPath

        public 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 Map<String,​String> env
        Specify environment variables that will be visible to the browser. Defaults to process.env.
      • executablePath

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

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

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

        public Boolean handleSIGTERM
        Close the browser process on SIGTERM. Defaults to true.
      • headless

        public 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 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 List<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 Double slowMo
        Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on.
      • timeout

        public 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 Path tracesDir
        If specified, traces are saved into this directory.
    • Constructor Detail

      • LaunchOptions

        public LaunchOptions()
    • Method Detail

      • setArgs

        public BrowserType.LaunchOptions setArgs​(List<String> args)
        NOTE: Use custom browser args at your own risk, as some of them may break Playwright functionality.

        Additional arguments to pass to the browser instance. The list of Chromium flags can be found here.

      • setChromiumSandbox

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

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

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