Overview
Thestart() function is the main entry point for launching a browser instance. It’s a helper function that accepts several keyword parameters and conveniently allows you to quickly launch an instance with best practice defaults by calling it without parameters.
Function signature
Parameters
A Config object containing all browser configuration options. If provided, other parameters are ignored.
Directory to store browser user data. If not specified, a temporary directory is created.
Launch browser in headless mode (without a visible window).
Path to the browser executable. If not provided, Zendriver will auto-detect Chrome or Brave.
Which browser to use. Options:
"chrome", "brave", or "auto" (tries Chrome first, then Brave).Additional command-line arguments to pass to the browser executable.Example:
["--some-chromeparam=somevalue", "--some-other-param=someval"]Enable or disable browser sandboxing. When
False, adds --no-sandbox to browser parameters. Automatically set to False when running as root on Linux.Language string for the browser (e.g.,
"en-US").Host address for connecting to an existing debuggable browser session. If both
host and port are provided, Zendriver will not start a local browser.Port number for connecting to an existing debuggable browser session. If both
host and port are provided, Zendriver will not start a local browser.Enable expert mode. When
True, includes parameters like --disable-web-security and --disable-site-isolation-trials, plus scripts and patching useful for debugging (e.g., ensuring shadow-root is always in “open” mode).Custom user agent string for the browser.
Additional keyword arguments passed to the Config object.
Returns
A Browser instance that can be used to control tabs and navigate pages.
Examples
Basic usage
Launch a browser with default settings:Headless mode
Launch in headless mode:Custom browser path
Specify a custom browser executable:Expert mode
Enable expert mode for debugging:Connect to existing browser
Connect to an already running debuggable browser:With custom arguments
Add custom browser arguments:Notes
- This function must be called with
awaitas it’s asynchronous - When running as root on Linux, sandbox is automatically disabled
- If both
hostandportare provided, Zendriver connects to an existing browser instead of launching a new one - The function returns a Browser instance that should be properly closed when done