Quick Start
This guide walks you through writing and running a simple automation script. You’ll navigate to a page, extract some text, and store it — all in about 5 minutes.
Step 1: Open a page
Section titled “Step 1: Open a page”Launch Guida and navigate to https://news.ycombinator.com using the address bar.
Step 2: Open the script editor
Section titled “Step 2: Open the script editor”Press Ctrl+N to open a new script tab, or go to File > New Script.
Step 3: Write a script
Section titled “Step 3: Write a script”Paste this into the editor:
async function main() { // Get the page title const title = await g.page.executeJS("document.title"); g.log("Page title: " + title);
// Extract the top 5 story titles const stories = await g.page.executeJS(` Array.from(document.querySelectorAll('.titleline > a')) .slice(0, 5) .map(a => a.textContent) `);
// Log each story for (const story of stories) { g.log(" " + story); }
g.log("Done! Found " + stories.length + " stories.");}Step 4: Run it
Section titled “Step 4: Run it”Press F5 or click the Run button. Watch the Console pane for output — you’ll see the page title and the top 5 Hacker News stories.
Step 5: Store the results
Section titled “Step 5: Store the results”Let’s save the data to a workspace store. First, open a workspace folder via File > Open Workspace (any empty folder works).
Then modify the script to store results:
async function main() { const stories = await g.page.executeJS(` Array.from(document.querySelectorAll('.titleline > a')) .slice(0, 5) .map(a => ({ title: a.textContent, url: a.href })) `);
// Store each story for (const story of stories) { const key = story.title.toLowerCase().replace(/\s+/g, '-').slice(0, 50); g.store.put("hn-stories", key, story); }
const count = g.store.count("hn-stories"); g.log(`Stored ${count} stories in 'hn-stories' collection`);}Run again with F5. The stories are now persisted in your workspace’s store — they’ll survive app restarts.
What’s next?
Section titled “What’s next?”- Browse the full
g.*API in the script editor — typeg.and IntelliSense will show all available methods - Generate scripting support files from Tools > Developer > Generate Scripting Support Files… if you want local editor or LLM context files
- Try the Recipes for real workflow examples
- Learn how Workspaces store scripts, queues, and data
- Try
await g.dom.click(".selector")to interact with page elements - Connect an MCP-capable LLM for AI-driven automation