Navigates the Chrome browser to the specified URL. This endpoint allows an agent to direct the browser to visit any valid website or web application. The browser will wait until the page's DOM content is loaded before considering the navigation complete.
Note: Chrome must be started with the POST /tools-api/system/open-chrome action first before using this endpoint.
| Parameter | Type | Required | Description |
|---|---|---|---|
| url | string | Yes | The URL to navigate to. Must be a valid absolute URL (e.g., "https://www.google.com"). The system will automatically add "https://" if no protocol is specified. |
{
"url": "https://www.google.com"
}
| Parameter | Type | Description |
|---|---|---|
| success | boolean | Indicates whether the navigation was successful. |
| message | string | A message describing the result of the navigation. In case of success, it will contain a confirmation message. In case of failure, it will contain error details. |
| timestamp | datetime | The timestamp when the action was completed. |
{
"success": true,
"message": "Successfully navigated to https://www.google.com",
"timestamp": "2023-11-01T14:30:45.123Z"
}
Important: The navigation will wait for the DOM content to be loaded, but it won't necessarily wait for all resources (images, scripts, etc.) to be fully loaded. The system uses a timeout of 30 seconds for the navigation to complete.
import requests
import json
# API configuration
api_url = "http://localhost:54321/tools-api/chrome/navigate"
api_key = "your_api_key_here"
# Request payload
payload = {
"url": "https://www.google.com"
}
# Headers with authentication
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {api_key}"
}
# Send the request
response = requests.post(api_url, headers=headers, data=json.dumps(payload))
# Process the response
if response.status_code == 200:
result = response.json()
print(f"Navigation successful: {result['message']}")
else:
print(f"Error: {response.status_code} - {response.text}")
import axios from 'axios';
// API configuration
const apiUrl = 'http://localhost:54321/tools-api/chrome/navigate';
const apiKey = 'your_api_key_here';
// Request payload
const payload = {
url: 'https://www.google.com'
};
// Headers with authentication
const headers = {
'Content-Type': 'application/json',
'Authorization': `Bearer ${apiKey}`
};
// Async function to send the request
async function navigateChrome() {
try {
const response = await axios.post(apiUrl, payload, { headers });
console.log(`Navigation successful: ${response.data.message}`);
return response.data;
} catch (error) {
console.error('Error navigating Chrome:', error.response?.data || error.message);
throw error;
}
}
// Call the function
navigateChrome();
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
public class ChromeNavigationExample
{
private static readonly HttpClient client = new HttpClient();
private const string ApiUrl = "http://localhost:54321/tools-api/chrome/navigate";
private const string ApiKey = "your_api_key_here";
public static async Task Main()
{
await NavigateChromeAsync("https://www.google.com");
}
public static async Task NavigateChromeAsync(string url)
{
// Request payload
var payload = new
{
url = url
};
// Convert payload to JSON
var jsonContent = JsonSerializer.Serialize(payload);
var content = new StringContent(jsonContent, Encoding.UTF8, "application/json");
// Add authorization header
client.DefaultRequestHeaders.Clear();
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {ApiKey}");
try
{
// Send the request
var response = await client.PostAsync(ApiUrl, content);
// Ensure success
response.EnsureSuccessStatusCode();
// Parse the response
var jsonResponse = await response.Content.ReadAsStringAsync();
var result = JsonSerializer.Deserialize(jsonResponse);
Console.WriteLine($"Navigation successful: {result.Message}");
}
catch (HttpRequestException ex)
{
Console.WriteLine($"Error navigating Chrome: {ex.Message}");
}
}
// Response class
private class ActionResponse
{
public bool Success { get; set; }
public string Message { get; set; }
public DateTime Timestamp { get; set; }
}
}
This example demonstrates how to navigate to Google:
{
"url": "https://www.google.com"
}
This example shows how to navigate directly to a search results page:
{
"url": "https://www.google.com/search?q=smooth+operator+windows+automation"
}
This example demonstrates navigation to a specific page on a website:
{
"url": "https://www.example.com/products/category/software"
}