Class BrowserType.LaunchOptions

java.lang.Object
com.microsoft.playwright.BrowserType.LaunchOptions
Enclosing interface:
BrowserType

public static class BrowserType.LaunchOptions extends Object
  • Field Details

    • args

      public List<String> args
      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.
    • devtools

      public 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 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 Details

    • LaunchOptions

      public LaunchOptions()
  • Method Details

    • setArgs

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

      Deprecated.
    • setChannel

      public BrowserType.LaunchOptions setChannel(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(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

      Specify environment variables that will be visible to the browser. Defaults to process.env.
    • 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.
    • setFirefoxUserPrefs

      public BrowserType.LaunchOptions setFirefoxUserPrefs(Map<String,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(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.
    • setProxy

      public BrowserType.LaunchOptions setProxy(String server)
      Network proxy settings.
    • setProxy

      public BrowserType.LaunchOptions setProxy(Proxy proxy)
      Network proxy settings.
    • 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(Path tracesDir)
      If specified, traces are saved into this directory.