Skip to main content
The close method gracefully closes the current browser window. For more control, you can also access the browser’s process ID to terminate the entire browser application.

Method Signature

async def close(
    self,
    *,
    timeout: int | None = None,
) -> None

Parameters

timeout
int | None
default:"None"
Maximum time in seconds to wait for the window to close. If None, uses the default system timeout.
timeout=5      # Wait up to 5 seconds
timeout=None   # Use default timeout

Return Value

This method returns None and completes when the window has been closed.

Example

  • Close Window
  • Quit Entire Browser
import asyncio
from narada import Narada

async def main():
    async with Narada() as narada:
        window = await narada.open_and_initialize_browser_window()

        # Perform automation tasks
        response = await window.agent(
            prompt="Search for Python tutorials and open the first result"
        )

        print(f"Task completed: {response.text}")

        # Close this specific window
        await window.close()

if __name__ == "__main__":
    asyncio.run(main())