Package com.microsoft.playwright
Class BrowserType.LaunchOptions
- java.lang.Object
-
- com.microsoft.playwright.BrowserType.LaunchOptions
-
- Enclosing interface:
- BrowserType
public static class BrowserType.LaunchOptions extends Object
-
-
Field Summary
Fields Modifier and Type Field Description List<String>argsNOTE: Use custom browser args at your own risk, as some of them may break Playwright functionality.ObjectchannelBrowser distribution channel.BooleanchromiumSandboxEnable Chromium sandboxing.BooleandevtoolsDeprecated.Use debugging tools instead.PathdownloadsPathIf specified, accepted downloads are downloaded into this directory.Map<String,String>envSpecify environment variables that will be visible to the browser.PathexecutablePathPath to a browser executable to run instead of the bundled one.Map<String,Object>firefoxUserPrefsFirefox user preferences.BooleanhandleSIGHUPClose the browser process on SIGHUP.BooleanhandleSIGINTClose the browser process on Ctrl-C.BooleanhandleSIGTERMClose the browser process on SIGTERM.BooleanheadlessWhether to run browser in headless mode.BooleanignoreAllDefaultArgsIftrue, Playwright does not pass its own configurations args and only uses the ones fromargs.List<String>ignoreDefaultArgsIftrue, Playwright does not pass its own configurations args and only uses the ones fromargs.ProxyproxyNetwork proxy settings.DoubleslowMoSlows down Playwright operations by the specified amount of milliseconds.DoubletimeoutMaximum time in milliseconds to wait for the browser instance to start.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(List<String> args)NOTE: Use custom browser args at your own risk, as some of them may break Playwright functionality.BrowserType.LaunchOptionssetChannel(BrowserChannel channel)Deprecated.BrowserType.LaunchOptionssetChannel(String channel)Browser distribution channel.BrowserType.LaunchOptionssetChromiumSandbox(boolean chromiumSandbox)Enable Chromium sandboxing.BrowserType.LaunchOptionssetDevtools(boolean devtools)Deprecated.Use debugging tools instead.BrowserType.LaunchOptionssetDownloadsPath(Path downloadsPath)If specified, accepted downloads are downloaded into this directory.BrowserType.LaunchOptionssetEnv(Map<String,String> env)Specify environment variables that will be visible to the browser.BrowserType.LaunchOptionssetExecutablePath(Path executablePath)Path to a browser executable to run instead of the bundled one.BrowserType.LaunchOptionssetFirefoxUserPrefs(Map<String,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(List<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(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(Path tracesDir)If specified, traces are saved into this directory.
-
-
-
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 tofalse.
-
devtools
public Boolean devtools
Deprecated.Use debugging tools instead.
-
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 toprocess.env.
-
executablePath
public 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 Map<String,Object> firefoxUserPrefs
Firefox user preferences. Learn more about the Firefox user preferences atabout:config.
-
handleSIGHUP
public Boolean handleSIGHUP
Close the browser process on SIGHUP. Defaults totrue.
-
handleSIGINT
public Boolean handleSIGINT
Close the browser process on Ctrl-C. Defaults totrue.
-
handleSIGTERM
public Boolean handleSIGTERM
Close the browser process on SIGTERM. Defaults totrue.
-
headless
public Boolean headless
-
ignoreAllDefaultArgs
public 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 List<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 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 to30000(30 seconds). Pass0to disable timeout.
-
tracesDir
public Path tracesDir
If specified, traces are saved into this directory.
-
-
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.
-
setChannel
@Deprecated public BrowserType.LaunchOptions setChannel(BrowserChannel channel)
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 tofalse.
-
setDevtools
public BrowserType.LaunchOptions setDevtools(boolean devtools)
Deprecated.Use debugging tools instead.
-
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
public BrowserType.LaunchOptions setEnv(Map<String,String> env)
Specify environment variables that will be visible to the browser. Defaults toprocess.env.
-
setExecutablePath
public BrowserType.LaunchOptions setExecutablePath(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(Map<String,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(List<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(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(Path tracesDir)
If specified, traces are saved into this directory.
-
-