MCPcopy
hub / github.com/microsoft/playwright-python / __init__

Method __init__

playwright/_impl/_page.py:160–277  ·  view source on GitHub ↗
(
        self, parent: ChannelOwner, type: str, guid: str, initializer: Dict
    )

Source from the content-addressed store, hash-verified

158 touchscreen: Touchscreen
159
160 def __init__(
161 self, parent: ChannelOwner, type: str, guid: str, initializer: Dict
162 ) -> None:
163 super().__init__(parent, type, guid, initializer)
164 self._browser_context = cast("BrowserContext", parent)
165 self.keyboard = Keyboard(self._channel)
166 self.mouse = Mouse(self._channel)
167 self.touchscreen = Touchscreen(self._channel)
168
169 self._main_frame: Frame = from_channel(initializer["mainFrame"])
170 self._main_frame._page = self
171 self._frames = [self._main_frame]
172 self._viewport_size: Optional[ViewportSize] = initializer.get("viewportSize")
173 self._is_closed = False
174 self._workers: List["Worker"] = []
175 self._bindings: Dict[str, Any] = {}
176 self._routes: List[RouteHandler] = []
177 self._web_socket_routes: List[WebSocketRouteHandler] = []
178 self._owned_context: Optional["BrowserContext"] = None
179 self._timeout_settings: TimeoutSettings = TimeoutSettings(
180 self._browser_context._timeout_settings
181 )
182 self._video: Video = Video(
183 self,
184 cast(Optional[Artifact], from_nullable_channel(initializer.get("video"))),
185 )
186 self._screencast: Screencast = Screencast(self)
187 self._local_storage = WebStorage(self, "local")
188 self._session_storage = WebStorage(self, "session")
189 self._opener = cast("Page", from_nullable_channel(initializer.get("opener")))
190 self._close_reason: Optional[str] = None
191 self._close_was_called = False
192 self._har_routers: List[HarRouter] = []
193 self._locator_handlers: Dict[str, LocatorHandler] = {}
194
195 self._channel.on(
196 "bindingCall",
197 lambda params: self._on_binding(from_channel(params["binding"])),
198 )
199 self._channel.on("close", lambda _: self._on_close())
200 self._channel.on("crash", lambda _: self._on_crash())
201 self._channel.on("download", lambda params: self._on_download(params))
202 self._channel.on(
203 "fileChooser",
204 lambda params: self.emit(
205 Page.Events.FileChooser,
206 FileChooser(
207 self, from_channel(params["element"]), params["isMultiple"]
208 ),
209 ),
210 )
211 self._channel.on(
212 "frameAttached",
213 lambda params: self._on_frame_attached(from_channel(params["frame"])),
214 )
215 self._channel.on(
216 "frameDetached",
217 lambda params: self._on_frame_detached(from_channel(params["frame"])),

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls 15

_on_bindingMethod · 0.95
_on_closeMethod · 0.95
_on_crashMethod · 0.95
_on_downloadMethod · 0.95
_on_frame_attachedMethod · 0.95
_on_frame_detachedMethod · 0.95
_on_routeMethod · 0.95
_on_web_socket_routeMethod · 0.95
_on_workerMethod · 0.95
onMethod · 0.95

Tested by

no test coverage detected