|
26 | 26 | from playwright.async_base import AsyncBase, AsyncEventContextManager, mapping |
27 | 27 | from playwright.browser import Browser as BrowserImpl |
28 | 28 | from playwright.browser_context import BrowserContext as BrowserContextImpl |
29 | | -from playwright.browser_server import BrowserServer as BrowserServerImpl |
30 | 29 | from playwright.browser_type import BrowserType as BrowserTypeImpl |
31 | 30 | from playwright.cdp_session import CDPSession as CDPSessionImpl |
32 | 31 | from playwright.chromium_browser_context import ( |
@@ -3070,6 +3069,11 @@ def workers(self) -> typing.List["Worker"]: |
3070 | 3069 | """ |
3071 | 3070 | return mapping.from_impl_list(self._impl_obj.workers) |
3072 | 3071 |
|
| 3072 | + def remove_listener(self, event: str, f: typing.Any) -> NoneType: |
| 3073 | + return mapping.from_maybe_impl( |
| 3074 | + self._impl_obj.remove_listener(event=event, f=mapping.to_impl(f)) |
| 3075 | + ) |
| 3076 | + |
3073 | 3077 | async def opener(self) -> typing.Union["Page", NoneType]: |
3074 | 3078 | """Page.opener |
3075 | 3079 |
|
@@ -5518,45 +5522,6 @@ async def close(self) -> NoneType: |
5518 | 5522 | mapping.register(BrowserImpl, Browser) |
5519 | 5523 |
|
5520 | 5524 |
|
5521 | | -class BrowserServer(AsyncBase): |
5522 | | - def __init__(self, obj: BrowserServerImpl): |
5523 | | - super().__init__(obj) |
5524 | | - |
5525 | | - @property |
5526 | | - def pid(self) -> str: |
5527 | | - return mapping.from_maybe_impl(self._impl_obj.pid) |
5528 | | - |
5529 | | - @property |
5530 | | - def wsEndpoint(self) -> str: |
5531 | | - """BrowserServer.wsEndpoint |
5532 | | -
|
5533 | | - Browser websocket endpoint which can be used as an argument to browserType.connect(options) to establish connection to the browser. |
5534 | | -
|
5535 | | - Returns |
5536 | | - ------- |
5537 | | - str |
5538 | | - Browser websocket url. |
5539 | | - """ |
5540 | | - return mapping.from_maybe_impl(self._impl_obj.wsEndpoint) |
5541 | | - |
5542 | | - async def kill(self) -> NoneType: |
5543 | | - """BrowserServer.kill |
5544 | | -
|
5545 | | - Kills the browser process and waits for the process to exit. |
5546 | | - """ |
5547 | | - return mapping.from_maybe_impl(await self._impl_obj.kill()) |
5548 | | - |
5549 | | - async def close(self) -> NoneType: |
5550 | | - """BrowserServer.close |
5551 | | -
|
5552 | | - Closes the browser gracefully and makes sure the process is terminated. |
5553 | | - """ |
5554 | | - return mapping.from_maybe_impl(await self._impl_obj.close()) |
5555 | | - |
5556 | | - |
5557 | | -mapping.register(BrowserServerImpl, BrowserServer) |
5558 | | - |
5559 | | - |
5560 | 5525 | class BrowserType(AsyncBase): |
5561 | 5526 | def __init__(self, obj: BrowserTypeImpl): |
5562 | 5527 | super().__init__(obj) |
@@ -5665,82 +5630,6 @@ async def launch( |
5665 | 5630 | ) |
5666 | 5631 | ) |
5667 | 5632 |
|
5668 | | - async def launchServer( |
5669 | | - self, |
5670 | | - executablePath: typing.Union[str, pathlib.Path] = None, |
5671 | | - args: typing.List[str] = None, |
5672 | | - ignoreDefaultArgs: typing.Union[bool, typing.List[str]] = None, |
5673 | | - handleSIGINT: bool = None, |
5674 | | - handleSIGTERM: bool = None, |
5675 | | - handleSIGHUP: bool = None, |
5676 | | - timeout: int = None, |
5677 | | - env: typing.Union[typing.Dict[str, typing.Union[str, int, bool]]] = None, |
5678 | | - headless: bool = None, |
5679 | | - devtools: bool = None, |
5680 | | - proxy: ProxyServer = None, |
5681 | | - downloadsPath: typing.Union[str, pathlib.Path] = None, |
5682 | | - port: int = None, |
5683 | | - chromiumSandbox: bool = None, |
5684 | | - ) -> "BrowserServer": |
5685 | | - """BrowserType.launchServer |
5686 | | -
|
5687 | | - Launches browser server that client can connect to. An example of launching a browser executable and connecting to it later: |
5688 | | -
|
5689 | | - Parameters |
5690 | | - ---------- |
5691 | | - executablePath : Union[str, pathlib.Path, NoneType] |
5692 | | - Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to current working directory. **BEWARE**: Playwright is only guaranteed to work with the bundled Chromium, Firefox or WebKit, use at your own risk. |
5693 | | - args : Optional[List[str]] |
5694 | | - Additional arguments to pass to the browser instance. The list of Chromium flags can be found here. |
5695 | | - ignoreDefaultArgs : Union[bool, List[str], NoneType] |
5696 | | - If `true`, then do not use any of the default arguments. If an array is given, then filter out the given default arguments. Dangerous option; use with care. Defaults to `false`. |
5697 | | - handleSIGINT : Optional[bool] |
5698 | | - Close the browser process on Ctrl-C. Defaults to `true`. |
5699 | | - handleSIGTERM : Optional[bool] |
5700 | | - Close the browser process on SIGTERM. Defaults to `true`. |
5701 | | - handleSIGHUP : Optional[bool] |
5702 | | - Close the browser process on SIGHUP. Defaults to `true`. |
5703 | | - timeout : Optional[int] |
5704 | | - Maximum time in milliseconds to wait for the browser instance to start. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. |
5705 | | - env : Optional[Dict[str, Union[str, int, bool]]] |
5706 | | - Specify environment variables that will be visible to the browser. Defaults to `process.env`. |
5707 | | - headless : Optional[bool] |
5708 | | - Whether to run browser in headless mode. More details for Chromium and Firefox. Defaults to `true` unless the `devtools` option is `true`. |
5709 | | - devtools : Optional[bool] |
5710 | | - **Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the `headless` option will be set `false`. |
5711 | | - proxy : Optional[{"server": str, "bypass": Optional[str], "username": Optional[str], "password": Optional[str]}] |
5712 | | - Network proxy settings. |
5713 | | - downloadsPath : Union[str, pathlib.Path, NoneType] |
5714 | | - If specified, accepted downloads are downloaded into this folder. Otherwise, temporary folder is created and is deleted when browser is closed. |
5715 | | - port : Optional[int] |
5716 | | - Port to use for the web socket. Defaults to 0 that picks any available port. |
5717 | | - chromiumSandbox : Optional[bool] |
5718 | | - Enable Chromium sandboxing. Defaults to `true`. |
5719 | | -
|
5720 | | - Returns |
5721 | | - ------- |
5722 | | - BrowserServer |
5723 | | - Promise which resolves to the browser app instance. |
5724 | | - """ |
5725 | | - return mapping.from_impl( |
5726 | | - await self._impl_obj.launchServer( |
5727 | | - executablePath=executablePath, |
5728 | | - args=args, |
5729 | | - ignoreDefaultArgs=ignoreDefaultArgs, |
5730 | | - handleSIGINT=handleSIGINT, |
5731 | | - handleSIGTERM=handleSIGTERM, |
5732 | | - handleSIGHUP=handleSIGHUP, |
5733 | | - timeout=timeout, |
5734 | | - env=mapping.to_impl(env), |
5735 | | - headless=headless, |
5736 | | - devtools=devtools, |
5737 | | - proxy=proxy, |
5738 | | - downloadsPath=downloadsPath, |
5739 | | - port=port, |
5740 | | - chromiumSandbox=chromiumSandbox, |
5741 | | - ) |
5742 | | - ) |
5743 | | - |
5744 | 5633 | async def launchPersistentContext( |
5745 | 5634 | self, |
5746 | 5635 | userDataDir: typing.Union[str, pathlib.Path], |
|
0 commit comments