MCPcopy Index your code
hub / github.com/microsoft/playwright-python / add_init_script

Method add_init_script

playwright/_impl/_page.py:673–684  ·  view source on GitHub ↗
(
        self, script: str = None, path: Union[str, Path] = None
    )

Source from the content-addressed store, hash-verified

671 await self._channel.send("hideHighlight", None)
672
673 async def add_init_script(
674 self, script: str = None, path: Union[str, Path] = None
675 ) -> Disposable:
676 if path:
677 script = add_source_url_to_script(
678 (await async_readfile(path)).decode(), path
679 )
680 if not isinstance(script, str):
681 raise Error("Either path or script parameter must be specified")
682 return from_channel(
683 await self._channel.send("addInitScript", None, dict(source=script))
684 )
685
686 async def route(
687 self, url: URLMatch, handler: RouteHandlerCallback, times: int = None

Calls 5

add_source_url_to_scriptFunction · 0.90
async_readfileFunction · 0.90
ErrorClass · 0.90
from_channelFunction · 0.90
sendMethod · 0.45