Skip to main content

getHTML

codebolt.browser.getHTML(): Promise<HtmlReceived>
Retrieves the HTML content of the current page.

Example

// Navigate to the page
await codebolt.browser.goToPage("https://example.com");

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

// Retrieve the HTML content of the current page
const htmlResult = await codebolt.browser.getHTML();
console.log('✅ HTML retrieved:', {
success: htmlResult.success,
htmlLength: htmlResult.html ? htmlResult.html.length : 0
});

// Access the actual HTML content
if (htmlResult.success && htmlResult.html) {
console.log('HTML content:', htmlResult.html);
// Process the HTML as needed
}