def create_remote_object(parent: ChannelOwner, type: str, guid: str,
                         initializer: Dict) -> Any:
    if type == "BindingCall":
        return BindingCall(parent, type, guid, initializer)
    if type == "Browser":
        return Browser(cast(BrowserType, parent), type, guid, initializer)
    if type == "BrowserType":
        return BrowserType(parent, type, guid, initializer)
    if type == "BrowserContext":
        browser_name: str = ""
        if isinstance(parent, Browser):
            browser_name = parent._browser_type.name
        if isinstance(parent, BrowserType):
            browser_name = parent.name
        if browser_name == "chromium":
            return ChromiumBrowserContext(parent, type, guid, initializer)
        return BrowserContext(parent, type, guid, initializer)
    if type == "CDPSession":
        return CDPSession(parent, type, guid, initializer)
    if type == "ConsoleMessage":
        return ConsoleMessage(parent, type, guid, initializer)
    if type == "Dialog":
        return Dialog(parent, type, guid, initializer)
    if type == "Download":
        return Download(parent, type, guid, initializer)
    if type == "ElementHandle":
        return ElementHandle(parent, type, guid, initializer)
    if type == "Frame":
        return Frame(parent, type, guid, initializer)
    if type == "JSHandle":
        return JSHandle(parent, type, guid, initializer)
    if type == "Page":
        return Page(parent, type, guid, initializer)
    if type == "Playwright":
        return Playwright(parent, type, guid, initializer)
    if type == "Request":
        return Request(parent, type, guid, initializer)
    if type == "Response":
        return Response(parent, type, guid, initializer)
    if type == "Route":
        return Route(parent, type, guid, initializer)
    if type == "WebSocket":
        return WebSocket(parent, type, guid, initializer)
    if type == "Worker":
        return Worker(parent, type, guid, initializer)
    if type == "Selectors":
        return Selectors(parent, type, guid, initializer)
    return DummyObject(parent, type, guid, initializer)
Exemple #2
0
def create_remote_object(parent: ChannelOwner, type: str, guid: str,
                         initializer: Dict) -> Any:
    if type == "BindingCall":
        return BindingCall(parent, type, guid, initializer)
    if type == "Browser":
        return Browser(parent, type, guid, initializer)
    if type == "BrowserServer":
        return BrowserServer(parent, type, guid, initializer)
    if type == "BrowserType":
        return BrowserType(parent, type, guid, initializer)
    if type == "BrowserContext":
        return BrowserContext(parent, type, guid, initializer)
    if type == "ConsoleMessage":
        return ConsoleMessage(parent, type, guid, initializer)
    if type == "Dialog":
        return Dialog(parent, type, guid, initializer)
    if type == "Download":
        return Download(parent, type, guid, initializer)
    if type == "ElementHandle":
        return ElementHandle(parent, type, guid, initializer)
    if type == "Frame":
        return Frame(parent, type, guid, initializer)
    if type == "JSHandle":
        return JSHandle(parent, type, guid, initializer)
    if type == "Page":
        return Page(parent, type, guid, initializer)
    if type == "Playwright":
        return Playwright(parent, type, guid, initializer)
    if type == "Request":
        return Request(parent, type, guid, initializer)
    if type == "Response":
        return Response(parent, type, guid, initializer)
    if type == "Route":
        return Route(parent, type, guid, initializer)
    if type == "Worker":
        return Worker(parent, type, guid, initializer)
    if type == "Selectors":
        return Selectors(parent, type, guid, initializer)
    return DummyObject(parent, type, guid, initializer)
Exemple #3
0
def create_remote_object(scope: ConnectionScope, type: str, guid: str,
                         initializer: Dict) -> Any:
    if type == "bindingCall":
        return BindingCall(scope, guid, initializer)
    if type == "browser":
        return Browser(scope, guid, initializer)
    if type == "browserServer":
        return BrowserServer(scope, guid, initializer)
    if type == "browserType":
        return BrowserType(scope, guid, initializer)
    if type == "context":
        return BrowserContext(scope, guid, initializer)
    if type == "consoleMessage":
        return ConsoleMessage(scope, guid, initializer)
    if type == "dialog":
        return Dialog(scope, guid, initializer)
    if type == "download":
        return Download(scope, guid, initializer)
    if type == "elementHandle":
        return ElementHandle(scope, guid, initializer)
    if type == "frame":
        return Frame(scope, guid, initializer)
    if type == "jsHandle":
        return JSHandle(scope, guid, initializer)
    if type == "page":
        return Page(scope, guid, initializer)
    if type == "playwright":
        return Playwright(scope, guid, initializer)
    if type == "request":
        return Request(scope, guid, initializer)
    if type == "response":
        return Response(scope, guid, initializer)
    if type == "route":
        return Route(scope, guid, initializer)
    if type == "worker":
        return Worker(scope, guid, initializer)
Exemple #4
0
 def _on_frame_detached(self, frame: Frame) -> None:
     self._frames.remove(frame)
     frame._detached = True
     self.emit(Page.Events.FrameDetached, frame)
Exemple #5
0
 def _on_frame_attached(self, frame: Frame) -> None:
     frame._page = self
     self._frames.append(frame)
     self.emit(Page.Events.FrameAttached, frame)
 def _on_frame_navigated(self, frame: Frame, url: str, name: str) -> None:
     frame._url = url
     frame._name = name
     self.emit(Page.Events.FrameNavigated, frame)