Skip to main content

goToPage

codebolt.browser.goToPage(url: string): Promise<GoToPageResponse>
Navigates the browser to a specific URL.

Parameters

NameTypeDescription
urlstringThe URL to navigate to (must include protocol like https://).

Example

// Wait for connection and create a new page
await codebolt.waitForConnection();
await codebolt.browser.newPage();

// Navigate to a webpage
const goToResult = await codebolt.browser.goToPage('https://example.com');
console.log('✅ Navigated to page:', goToResult);

// Wait for the page to fully load
await new Promise(resolve => setTimeout(resolve, 2000));

// Verify the navigation was successful
const currentUrl = await codebolt.browser.getUrl();
console.log('✅ Current URL after navigation:', currentUrl);

// Example with different websites
await codebolt.browser.goToPage('https://www.google.com');
await codebolt.browser.goToPage('https://github.com');

Response Structure

{
event: 'browserActionResponse',
eventId: 'goToPage_1750401433630',
payload: {
content: '"Navigated to https://example.com"',
viewport: {
width: 767,
height: 577
},
currentUrl: 'https://example.com'
},
type: 'goToPageResponse'
}

Explanation

The codebolt.browser.goToPage(url) function navigates the browser to a specified URL. This is one of the most fundamental browser automation functions, allowing you to load different web pages programmatically.