mokr.launch.firefox
Module Contents
Classes
Class to handle launching browser process and creation of a |
Attributes
- mokr.launch.firefox.CHROME_PROFILE_PATH
- mokr.launch.firefox.DEFAULT_FIREFOX_USER_PREFS
- class mokr.launch.firefox.FirefoxLauncher(*args, **kwargs)
Bases:
mokr.launch.base.LauncherClass to handle launching browser process and creation of a
mokr.browser.Browserobject.- Parameters:
binary_path (str, optional) – Path to executable to use. Defaults to None (looks for default executable that can be installed via
mokr install).headless (bool, optional) – Run the browser in headless (no window) mode. Defaults to None (uses opposite value to
devtools).user_data_dir (str, optional) – Path to a user data directory. Defaults to None.
devtools (bool, optional) – Automatically open the developer tools panel. Defaults to False.
ignore_default_args (bool | list[str], optional) – 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.
ignore_https_errors (bool, optional) – Ignore site security errors. Defaults to False.
default_viewport (dict[str, int], optional) – 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).
proxy (str, optional) – Proxy to route all requests through. Can be a regular HTTP/S proxy or SOCKS proxy. Expects proxy as
<scheme>://[(optional)<username>:<password>]@<host><password>.default_user_agent (str, optional) – Default user agent to use on all new pages.
slow_mo (int, optional) – Slow execution of remote calls by the given time in milliseconds. Defaults to 0.
log_level (str | int, optional) – Log level to log at. Defaults to None (same as root).
args (list[str], optional) – Additional arguments to pass to the browser process when launching. Defaults to None.
dumpio (bool, optional) – Pipe the browser process’ stdout and stderr into
process.stdoutandprocess.stderr. Defaults to False.env (dict[str, str], optional) – Additional environment variables that the browser process will be able to read. Defaults to None.
loop (asyncio.AbstractEventLoop, optional) – A running asyncio loop to execute within. Defaults to None (uses
asyncio.get_event_loop).firefox_user_prefs (dict) – Firefox only. User preferences to load.
firefox_addons_paths (list[str]) – Firefox only. A list of paths to addons that will be installed as temporary extensions.
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() ```- kind = 'firefox'
- async launch() mokr.browser.browser.Browser
Start browser process and return a
mokr.browser.Browserobject.