Documentation Index
Fetch the complete documentation index at: https://docs.narada.ai/llms.txt
Use this file to discover all available pages before exploring further.
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
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.output.content}")
# Close this specific window
await window.close()
if __name__ == "__main__":
asyncio.run(main())
import asyncio
import os
import signal
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.output.content}")
# Get the browser process ID (only available for locally launched browsers)
pid = window.browser_process_id
# Terminate the entire browser process
if pid is not None:
print(f"Terminating browser process with PID: {pid}")
os.kill(pid, signal.SIGTERM)
if __name__ == "__main__":
asyncio.run(main())