The go_to_url method provides a simple, reliable way to navigate browser windows to specific URLs programmatically. Use this method to set up automation workflows that need to start from specific web pages or navigate between different sites during task execution.
The go_to_url method waits for the navigation to complete before returning. This makes it useful for setting up initial page states or navigating between pages in multi-step workflows.

Method Signature

async def go_to_url(
    self,
    *,
    url: str,
    new_tab: bool = False,
    timeout: int | None = None,
) -> None

Parameters

url
str
required
The target URL to navigate to. Must be a valid HTTP or HTTPS URL.
url="https://www.google.com"
url="https://arxiv.org/list/cs.AI/recent"
new_tab
bool
default:"False"
Whether to open the URL in a new tab instead of navigating the current tab.
new_tab=False  # Navigate current tab (default)
new_tab=True   # Open in new tab
timeout
int | None
default:"None"
Maximum time in seconds to wait for navigation to complete. If None, uses the default system timeout.
timeout=30     # Wait up to 30 seconds
timeout=None   # Use default timeout

Return Value

This method returns None and completes when the navigation is successful.

Example

import asyncio
from narada import Narada

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

        # Navigate to a specific page
        await window.go_to_url(url="https://www.google.com")

        # Now perform actions on the current page
        response = await window.agent(
            prompt="search for 'python automation' and get the first result"
        )

        print(f"Result: {response.text}")

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

Common Use Cases

Workflow Setup

Navigate to starting pages
  • Set up initial page state
  • Navigate to login pages
  • Access specific application sections
  • Load data entry forms

Multi-Page Analysis

Compare across multiple sources
  • Open comparison sites in new tabs
  • Gather data from different pages
  • Cross-reference information
  • Aggregate research findings

Sequential Processing

Process items one by one
  • Navigate through search results
  • Visit each item in a list
  • Process form submissions
  • Follow workflow steps

Resource Collection

Gather resources systematically
  • Download files from multiple sources
  • Collect images or documents
  • Archive web content
  • Build resource libraries

Best Practices

URL Validation

Always use complete, valid URLs with protocol (https://) for reliable navigation

Timeout Management

Set appropriate timeouts for slow-loading pages or unreliable network conditions

Error Handling

Implement proper error handling for navigation failures and network issues

Tab Management

Use new_tab=True strategically to keep important pages open for reference

Error Handling

The go_to_url method can raise the following exceptions:

Integration with Other Methods

The go_to_url method works seamlessly with other Window methods:
# Navigate then perform actions
await window.go_to_url(url="https://example.com")
await window.agent(prompt="fill out the contact form")

# Navigate then use selectors
await window.go_to_url(url="https://app.example.com")
await window.agentic_selector(
    action={"type": "click"},
    selectors={"aria_label": "Login"},
    fallback_operator_query="click the login button"
)

# Navigate then read data
await window.go_to_url(url="https://sheets.google.com/spreadsheet/123")
data = await window.read_google_sheet(
    spreadsheet_id="123",
    range="A1:C10"
)

Performance Considerations

The go_to_url method waits for the page to fully load before returning. For pages with heavy JavaScript or many resources, consider using appropriate timeout values to avoid long wait times.
When working with multiple pages, consider opening them in new tabs rather than navigating back and forth, which can be more efficient for comparison tasks.