64 lines
1.8 KiB
Python
64 lines
1.8 KiB
Python
"""
|
|
This type stub file was generated by pyright.
|
|
"""
|
|
|
|
import asyncio
|
|
from typing import Any, Callable, Coroutine, Dict, List, Optional, TYPE_CHECKING
|
|
from pyppeteer.connection import CDPSession
|
|
from pyppeteer.page import Page
|
|
from pyppeteer.browser import Browser, BrowserContext
|
|
|
|
"""Target module."""
|
|
if TYPE_CHECKING:
|
|
...
|
|
class Target:
|
|
"""Browser's target class."""
|
|
def __init__(self, targetInfo: Dict, browserContext: BrowserContext, sessionFactory: Callable[[], Coroutine[Any, Any, CDPSession]], ignoreHTTPSErrors: bool, defaultViewport: Optional[Dict], screenshotTaskQueue: List, loop: asyncio.AbstractEventLoop) -> None:
|
|
...
|
|
|
|
async def createCDPSession(self) -> CDPSession:
|
|
"""Create a Chrome Devtools Protocol session attached to the target."""
|
|
...
|
|
|
|
async def page(self) -> Optional[Page]:
|
|
"""Get page of this target.
|
|
|
|
If the target is not of type "page" or "background_page", return
|
|
``None``.
|
|
"""
|
|
...
|
|
|
|
@property
|
|
def url(self) -> str:
|
|
"""Get url of this target."""
|
|
...
|
|
|
|
@property
|
|
def type(self) -> str:
|
|
"""Get type of this target.
|
|
|
|
Type can be ``'page'``, ``'background_page'``, ``'service_worker'``,
|
|
``'browser'``, or ``'other'``.
|
|
"""
|
|
...
|
|
|
|
@property
|
|
def browser(self) -> Browser:
|
|
"""Get the browser the target belongs to."""
|
|
...
|
|
|
|
@property
|
|
def browserContext(self) -> BrowserContext:
|
|
"""Return the browser context the target belongs to."""
|
|
...
|
|
|
|
@property
|
|
def opener(self) -> Optional[Target]:
|
|
"""Get the target that opened this target.
|
|
|
|
Top-level targets return ``None``.
|
|
"""
|
|
...
|
|
|
|
|
|
|