Package com.microsoft.playwright
Class BrowserType.LaunchOptions
- java.lang.Object
-
- com.microsoft.playwright.BrowserType.LaunchOptions
-
- Enclosing interface:
- BrowserType
public static class BrowserType.LaunchOptions extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description java.util.List<java.lang.String>argsAdditional arguments to pass to the browser instance.java.lang.ObjectchannelBrowser distribution channel.java.lang.BooleanchromiumSandboxEnable Chromium sandboxing.java.lang.Booleandevtools**Chromium-only** Whether to auto-open a Developer Tools panel for each tab.java.nio.file.PathdownloadsPathIf specified, accepted downloads are downloaded into this directory.java.util.Map<java.lang.String,java.lang.String>envSpecify environment variables that will be visible to the browser.java.nio.file.PathexecutablePathPath to a browser executable to run instead of the bundled one.java.util.Map<java.lang.String,java.lang.Object>firefoxUserPrefsFirefox user preferences.java.lang.BooleanhandleSIGHUPClose the browser process on SIGHUP.java.lang.BooleanhandleSIGINTClose the browser process on Ctrl-C.java.lang.BooleanhandleSIGTERMClose the browser process on SIGTERM.java.lang.BooleanheadlessWhether to run browser in headless mode.java.lang.BooleanignoreAllDefaultArgsIftrue, Playwright does not pass its own configurations args and only uses the ones fromargs.java.util.List<java.lang.String>ignoreDefaultArgsIftrue, Playwright does not pass its own configurations args and only uses the ones fromargs.ProxyproxyNetwork proxy settings.java.lang.DoubleslowMoSlows down Playwright operations by the specified amount of milliseconds.java.lang.DoubletimeoutMaximum time in milliseconds to wait for the browser instance to start.java.nio.file.PathtracesDirIf specified, traces are saved into this directory.
-
Constructor Summary
Constructors Constructor Description LaunchOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description BrowserType.LaunchOptionssetArgs(java.util.List<java.lang.String> args)Additional arguments to pass to the browser instance.BrowserType.LaunchOptionssetChannel(BrowserChannel channel)Deprecated.BrowserType.LaunchOptionssetChannel(java.lang.String channel)Browser distribution channel.BrowserType.LaunchOptionssetChromiumSandbox(boolean chromiumSandbox)Enable Chromium sandboxing.BrowserType.LaunchOptionssetDevtools(boolean devtools)**Chromium-only** Whether to auto-open a Developer Tools panel for each tab.BrowserType.LaunchOptionssetDownloadsPath(java.nio.file.Path downloadsPath)If specified, accepted downloads are downloaded into this directory.BrowserType.LaunchOptionssetEnv(java.util.Map<java.lang.String,java.lang.String> env)Specify environment variables that will be visible to the browser.BrowserType.LaunchOptionssetExecutablePath(java.nio.file.Path executablePath)Path to a browser executable to run instead of the bundled one.BrowserType.LaunchOptionssetFirefoxUserPrefs(java.util.Map<java.lang.String,java.lang.Object> firefoxUserPrefs)Firefox user preferences.BrowserType.LaunchOptionssetHandleSIGHUP(boolean handleSIGHUP)Close the browser process on SIGHUP.BrowserType.LaunchOptionssetHandleSIGINT(boolean handleSIGINT)Close the browser process on Ctrl-C.BrowserType.LaunchOptionssetHandleSIGTERM(boolean handleSIGTERM)Close the browser process on SIGTERM.BrowserType.LaunchOptionssetHeadless(boolean headless)Whether to run browser in headless mode.BrowserType.LaunchOptionssetIgnoreAllDefaultArgs(boolean ignoreAllDefaultArgs)Iftrue, Playwright does not pass its own configurations args and only uses the ones fromargs.BrowserType.LaunchOptionssetIgnoreDefaultArgs(java.util.List<java.lang.String> ignoreDefaultArgs)Iftrue, Playwright does not pass its own configurations args and only uses the ones fromargs.BrowserType.LaunchOptionssetProxy(Proxy proxy)Network proxy settings.BrowserType.LaunchOptionssetProxy(java.lang.String server)Network proxy settings.BrowserType.LaunchOptionssetSlowMo(double slowMo)Slows down Playwright operations by the specified amount of milliseconds.BrowserType.LaunchOptionssetTimeout(double timeout)Maximum time in milliseconds to wait for the browser instance to start.BrowserType.LaunchOptionssetTracesDir(java.nio.file.Path tracesDir)If specified, traces are saved into this directory.
-
-
-
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 tofalse.
-
devtools
public java.lang.Boolean devtools
**Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option istrue, theheadlessoption will be setfalse.
-
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 toprocess.env.
-
executablePath
public java.nio.file.Path executablePath
Path to a browser executable to run instead of the bundled one. IfexecutablePathis 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 atabout:config.
-
handleSIGHUP
public java.lang.Boolean handleSIGHUP
Close the browser process on SIGHUP. Defaults totrue.
-
handleSIGINT
public java.lang.Boolean handleSIGINT
Close the browser process on Ctrl-C. Defaults totrue.
-
handleSIGTERM
public java.lang.Boolean handleSIGTERM
Close the browser process on SIGTERM. Defaults totrue.
-
headless
public java.lang.Boolean headless
-
ignoreAllDefaultArgs
public java.lang.Boolean ignoreAllDefaultArgs
Iftrue, Playwright does not pass its own configurations args and only uses the ones fromargs. Dangerous option; use with care. Defaults tofalse.
-
ignoreDefaultArgs
public java.util.List<java.lang.String> ignoreDefaultArgs
Iftrue, Playwright does not pass its own configurations args and only uses the ones fromargs. 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 to30000(30 seconds). Pass0to disable timeout.
-
tracesDir
public java.nio.file.Path tracesDir
If specified, traces are saved into this directory.
-
-
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
@Deprecated public BrowserType.LaunchOptions setChannel(BrowserChannel channel)
Deprecated.
-
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 tofalse.
-
setDevtools
public BrowserType.LaunchOptions setDevtools(boolean devtools)
**Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option istrue, theheadlessoption will be setfalse.
-
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 toprocess.env.
-
setExecutablePath
public BrowserType.LaunchOptions setExecutablePath(java.nio.file.Path executablePath)
Path to a browser executable to run instead of the bundled one. IfexecutablePathis 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 atabout:config.
-
setHandleSIGHUP
public BrowserType.LaunchOptions setHandleSIGHUP(boolean handleSIGHUP)
Close the browser process on SIGHUP. Defaults totrue.
-
setHandleSIGINT
public BrowserType.LaunchOptions setHandleSIGINT(boolean handleSIGINT)
Close the browser process on Ctrl-C. Defaults totrue.
-
setHandleSIGTERM
public BrowserType.LaunchOptions setHandleSIGTERM(boolean handleSIGTERM)
Close the browser process on SIGTERM. Defaults totrue.
-
setHeadless
public BrowserType.LaunchOptions setHeadless(boolean headless)
-
setIgnoreAllDefaultArgs
public BrowserType.LaunchOptions setIgnoreAllDefaultArgs(boolean ignoreAllDefaultArgs)
Iftrue, Playwright does not pass its own configurations args and only uses the ones fromargs. Dangerous option; use with care. Defaults tofalse.
-
setIgnoreDefaultArgs
public BrowserType.LaunchOptions setIgnoreDefaultArgs(java.util.List<java.lang.String> ignoreDefaultArgs)
Iftrue, Playwright does not pass its own configurations args and only uses the ones fromargs. Dangerous option; use with care.
-
setProxy
public BrowserType.LaunchOptions setProxy(java.lang.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 to30000(30 seconds). Pass0to disable timeout.
-
setTracesDir
public BrowserType.LaunchOptions setTracesDir(java.nio.file.Path tracesDir)
If specified, traces are saved into this directory.
-
-