mokr.browser.target =================== .. py:module:: mokr.browser.target Attributes ---------- .. autoapisummary:: mokr.browser.target.KINDS Classes ------- .. autoapisummary:: mokr.browser.target.Target Module Contents --------------- .. py:data:: KINDS .. py:class:: Target(browser: mokr.browser.Browser, target_info: dict, browser_context: mokr.browser.context.BrowserContext, session_factory: Callable, ignore_https_errors: bool, default_viewport: dict | None, screenshot_task_queue: list, loop: asyncio.AbstractEventLoop, proxy_credentials: dict | None = None, user_agent_data: dict[str, str] | None = None) Representative of a remote target. Targets are a somewhat obscure concept, they can be a browser, frame, page, worker, or more. For the purposes of this package, only browser, pages, and workers are tracked explicitly. Full list of target types can be found at `devtools_agent_host_impl.cc` at https://source.chromium.org/chromium/chromium/src/. :param browser: Parent `mokr.browser.Browser`. :type browser: Browser :param target_info: The "targetInfo" in the event emitted that triggered this object's initialisation. :type target_info: dict :param browser_context: The `mokr.browser.BrowserContext` that this spawned from. :type browser_context: BrowserContext :param session_factory: Callable that creates a new `mokr.connection.DevtoolsConnection` for this target. :type session_factory: Callable :param ignore_https_errors: Whether network security errors should be ignored or not. Inherited from parent `mokr.browser.Browser`. :type ignore_https_errors: bool :param default_viewport: Default viewport configuration. Inherited from parent `mokr.browser.Browser`. :type default_viewport: dict | None :param screenshot_task_queue: The screenshot task queue, empty by default. Inherited from parent `mokr.browser.Browser`. :type screenshot_task_queue: list :param loop: The `asyncio` loop that is tracked under the `mokr.browser.Browser`'s `mokr.connection.Connection`. :type loop: asyncio.AbstractEventLoop :param proxy_credentials: (dict | None, optional): Dictionary with proxy credentials keyed as "username" and "password". Credentials should be for the proxy the browser process is bound to. Inherited from parent `mokr.browser.Browser`. :param user_agent_data: A dictionary containing the user agent and an indicator to whether it was the original or an override. :type user_agent_data: dict[str, str] | None, optional .. py:property:: url :type: str Get url of this target. .. py:property:: kind :type: KINDS Get type of this target. Type may be on of "page", "background_page", "service_worker", "browser", or "other". .. py:property:: browser :type: mokr.browser.Browser The `mokr.browser.Browser` that owns the `mokr.browser.BrowserContext` that this target was initialised from. .. py:property:: browser_context :type: mokr.browser.context.BrowserContext `mokr.browser.BrowserContext` this target was initialised from. .. py:property:: opener :type: Target | None The parent `Target` that spawned this, if any. .. py:method:: create_devtools_connection() -> mokr.connection.DevtoolsConnection :async: Initialise the `mokr.connection.DevtoolsConnection` that will be bound to this `Target`. :returns: The new `mokr.connection.DevtoolsConnection`. :rtype: DevtoolsConnection .. py:method:: page() -> mokr.browser.page.Page | None :async: Get the `mokr.browser.Page` object attached to this `Target`. Only applicable if `Target.kind` is "page" or "background_page". :returns: Associated `mokr.browser.Page`, if any. :rtype: Page | None