mokr.launch.chrome ================== .. py:module:: mokr.launch.chrome Attributes ---------- .. autoapisummary:: mokr.launch.chrome.CHROME_PROFILE_PATH mokr.launch.chrome.DEFAULT_CHROME_ARGS Classes ------- .. autoapisummary:: mokr.launch.chrome.ChromeLauncher Module Contents --------------- .. py:data:: CHROME_PROFILE_PATH .. py:data:: DEFAULT_CHROME_ARGS :value: ['--allow-pre-commit-input', '--disable-background-networking',... .. py:class:: ChromeLauncher(binary_path: str = None, headless: bool = None, user_data_dir: str = None, devtools: bool = False, ignore_default_args: bool | list[str] = False, ignore_https_errors: bool = False, default_viewport: dict[str, int] = None, proxy: str = None, default_user_agent: str = None, slow_mo: int = 0, log_level: str | int = None, args: list[str] = None, dumpio: bool = False, env: dict[str, str] = None, loop: asyncio.AbstractEventLoop = None, firefox_user_prefs: dict = None, firefox_addons_paths: list[str] = None) Bases: :py:obj:`mokr.launch.base.Launcher` Class to handle launching browser process and creation of a `mokr.browser.Browser` object. :param binary_path: Path to executable to use. Defaults to None (looks for default executable that can be installed via `mokr install`). :type binary_path: str, optional :param headless: Run the browser in headless (no window) mode. Defaults to None (uses opposite value to `devtools`). :type headless: bool, optional :param user_data_dir: Path to a user data directory. Defaults to None. :type user_data_dir: str, optional :param devtools: Automatically open the developer tools panel. Defaults to False. :type devtools: bool, optional :param ignore_default_args: Either a bool to indicate ignoring all arguments or a list of arguments to ignore. Be cautious, ignoring some arguments may cause unexpected results. Defaults to False. :type ignore_default_args: bool | list[str], optional :param ignore_https_errors: Ignore site security errors. Defaults to False. :type ignore_https_errors: bool, optional :param default_viewport: Set the default viewport for new pages. Accepts a dictionary keyed with viewport options. Not all viewport options are considered, only: "isMobile", "width", "height", "deviceScaleFactor", "isLandscape", and "hasTouch". Defaults to None (800x600 viewport). :type default_viewport: dict[str, int], optional :param proxy: Proxy to route all requests through. Can be a regular HTTP/S proxy or SOCKS proxy. Expects proxy as `://[(optional):]@`. :type proxy: str, optional :param default_user_agent: Default user agent to use on all new pages. :type default_user_agent: str, optional :param slow_mo: Slow execution of remote calls by the given time in milliseconds. Defaults to 0. :type slow_mo: int, optional :param log_level: Log level to log at. Defaults to None (same as root). :type log_level: str | int, optional :param args: Additional arguments to pass to the browser process when launching. Defaults to None. :type args: list[str], optional :param dumpio: Pipe the browser process' stdout and stderr into ``process.stdout`` and ``process.stderr``. Defaults to False. :type dumpio: bool, optional :param env: Additional environment variables that the browser process will be able to read. Defaults to None. :type env: dict[str, str], optional :param loop: A running asyncio loop to execute within. Defaults to None (uses `asyncio.get_event_loop`). :type loop: asyncio.AbstractEventLoop, optional :param firefox_user_prefs: Firefox only. User preferences to load. :type firefox_user_prefs: dict :param firefox_addons_paths: Firefox only. A list of paths to addons that will be installed as temporary extensions. :type firefox_addons_paths: list[str] Example:: ```python from mokr.launch import ChromeLauncher, FirefoxLauncher async with ChromeLauncher() as browser: page = await browser.first_page() await page.goto("https://example.com") # Or, to avoid the contextmanager. launcher = FirefoxLauncher() browser = await launcher.launch() page = await browser.first_page() await page.goto("https://example.com") await launcher.stop() ``` .. py:attribute:: kind :value: 'chrome'