Use this as the smallest useful browser automation script. It creates a tab, navigates, and reads basic page state from the active browser.
// Open a Page — Navigate the browser to a URL//// This script shows how to navigate to a URL and wait// for the page to fully load before continuing.
const url = "https://example.com";
// Ensure we have a browser tab to work withawait g.tabs.newBrowserTab();
g.log("Navigating to " + url + "...");
// Navigate and wait for the page to loadawait g.nav.navigateToUrl(url);g.log("Page loaded!");
// Read the page title via executeJSconst title = await g.page.executeJS("document.title");if (title) { g.log("Page title: " + title);}
// Get the final URL (might differ if redirected)const finalUrl = await g.page.getUrl();g.log("Final URL: " + finalUrl);