Helper function to launch a browser. It accepts several keyword parameters. Conveniently, you can just call it bare (no parameters) to quickly launch an instance with best practice defaults. Note: Due to a Chrome-130 bug, use start_async or start_sync instead. (Calling thi
(
config: Optional[Config] = None,
*,
user_data_dir: Optional[PathLike] = None,
headless: Optional[bool] = None,
incognito: Optional[bool] = None,
guest: Optional[bool] = None,
browser_executable_path: Optional[PathLike] = None,
browser_args: Optional[List[str]] = None,
xvfb_metrics: Optional[List[str]] = None, # "Width,Height" for Linux
ad_block: Optional[bool] = None,
sandbox: Optional[bool] = True,
lang: Optional[str] = None, # Set the Language Locale Code
host: Optional[str] = None, # Chrome remote-debugging-host
port: Optional[int] = None, # Chrome remote-debugging-port
xvfb: Optional[int] = None, # Use a special virtual display on Linux
headed: Optional[bool] = None, # Override default Xvfb mode on Linux
expert: Optional[bool] = None, # Open up closed Shadow-root elements
agent: Optional[str] = None, # Set the user-agent string
proxy: Optional[str] = None, # "host:port" or "user:pass@host:port"
tzone: Optional[str] = None, # Eg "America/New_York", "Asia/Kolkata"
geoloc: Optional[list | tuple] = None, # Eg (48.87645, 2.26340)
mobile: Optional[bool] = None, # Use Mobile Mode with default args
disable_csp: Optional[str] = None, # Disable content security policy
extension_dir: Optional[str] = None, # Chrome extension directory
use_chromium: Optional[str] = None, # Use the base Chromium browser
cft: Optional[str] = None, # Use the Chrome-for-Testing browser
**kwargs: Optional[dict],
)
| 286 | |
| 287 | |
| 288 | async def start( |
| 289 | config: Optional[Config] = None, |
| 290 | *, |
| 291 | user_data_dir: Optional[PathLike] = None, |
| 292 | headless: Optional[bool] = None, |
| 293 | incognito: Optional[bool] = None, |
| 294 | guest: Optional[bool] = None, |
| 295 | browser_executable_path: Optional[PathLike] = None, |
| 296 | browser_args: Optional[List[str]] = None, |
| 297 | xvfb_metrics: Optional[List[str]] = None, # "Width,Height" for Linux |
| 298 | ad_block: Optional[bool] = None, |
| 299 | sandbox: Optional[bool] = True, |
| 300 | lang: Optional[str] = None, # Set the Language Locale Code |
| 301 | host: Optional[str] = None, # Chrome remote-debugging-host |
| 302 | port: Optional[int] = None, # Chrome remote-debugging-port |
| 303 | xvfb: Optional[int] = None, # Use a special virtual display on Linux |
| 304 | headed: Optional[bool] = None, # Override default Xvfb mode on Linux |
| 305 | expert: Optional[bool] = None, # Open up closed Shadow-root elements |
| 306 | agent: Optional[str] = None, # Set the user-agent string |
| 307 | proxy: Optional[str] = None, # "host:port" or "user:pass@host:port" |
| 308 | tzone: Optional[str] = None, # Eg "America/New_York", "Asia/Kolkata" |
| 309 | geoloc: Optional[list | tuple] = None, # Eg (48.87645, 2.26340) |
| 310 | mobile: Optional[bool] = None, # Use Mobile Mode with default args |
| 311 | disable_csp: Optional[str] = None, # Disable content security policy |
| 312 | extension_dir: Optional[str] = None, # Chrome extension directory |
| 313 | use_chromium: Optional[str] = None, # Use the base Chromium browser |
| 314 | cft: Optional[str] = None, # Use the Chrome-for-Testing browser |
| 315 | **kwargs: Optional[dict], |
| 316 | ) -> Browser: |
| 317 | """ |
| 318 | Helper function to launch a browser. It accepts several keyword parameters. |
| 319 | Conveniently, you can just call it bare (no parameters) to quickly launch |
| 320 | an instance with best practice defaults. |
| 321 | Note: Due to a Chrome-130 bug, use start_async or start_sync instead. |
| 322 | (Calling this method directly could lead to an unresponsive browser) |
| 323 | Note: New args are expected: Use kwargs only! |
| 324 | Note: This should be called ``await start()`` |
| 325 | :param user_data_dir: |
| 326 | :type user_data_dir: PathLike |
| 327 | :param headless: |
| 328 | :type headless: bool |
| 329 | :param browser_executable_path: |
| 330 | :type browser_executable_path: PathLike |
| 331 | :param browser_args: |
| 332 | ["--some-chromeparam=somevalue", "some-other-param=someval"] |
| 333 | :type browser_args: List[str] |
| 334 | :param sandbox: Default True, but when set to False it adds --no-sandbox |
| 335 | to the params, also when using linux under a root user, |
| 336 | it adds False automatically (else Chrome won't start). |
| 337 | :type sandbox: bool |
| 338 | :param lang: language string |
| 339 | :type lang: str |
| 340 | :param port: If you connect to an existing debuggable session, |
| 341 | you can specify the port here. |
| 342 | If both host and port are provided, |
| 343 | then a local Chrome browser will not be started! |
| 344 | :type port: int |
| 345 | :param host: If you connect to an existing debuggable session, |
no test coverage detected
searching dependent graphs…