> ## 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.

# get_url

> Get the URL of the current active page in the browser window

The `get_url` method retrieves the URL of the currently active page in the browser window. This is useful for verifying navigation, capturing the current state, or building conditional logic based on the page location.

## Method Signature

```python theme={null}
async def get_url(
    self,
    *,
    timeout: int | None = None,
) -> GetUrlResponse
```

## Parameters

<ParamField query="timeout" type="int | None" default="None">
  Optional timeout in milliseconds. If not specified, uses the default timeout.
</ParamField>

## Return Value

Returns a `GetUrlResponse` object:

<ResponseField name="url" type="str">
  The URL of the currently active page.
</ResponseField>

## Example

```python theme={null}
import asyncio

from narada import Agent, BrowserEnvironment

async def main():
    env = BrowserEnvironment()
    agent = Agent(environment=env)

    try:
        # Navigate to a page
        await agent.go_to_url(url="https://www.google.com", new_tab=True)

        # Get the current URL
        response = await agent.get_url()
        print(f"Current URL: {response.url}")
        # Output: Current URL: https://www.google.com/

        # Use in conditional logic
        await agent.run(prompt="Search for Narada AI")

        response = await agent.get_url()
        if "search" in response.url:
            print("Search results page loaded successfully")
    finally:
        await env.close()

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

## Use Cases

<CardGroup cols={2}>
  <Card title="Verify Navigation" icon="check">
    Confirm the browser navigated to the expected page after an action
  </Card>

  <Card title="Conditional Logic" icon="code-branch">
    Branch your automation based on the current page URL
  </Card>

  <Card title="Logging & Debugging" icon="bug">
    Log the current URL at each step for debugging automation flows
  </Card>

  <Card title="URL Extraction" icon="link">
    Capture the final URL after redirects or form submissions
  </Card>
</CardGroup>
