How to use page.goto

A page object spawned in by using the newPage() method can be used to navigate a page. The goto() method enters the given url into the new tab and navigates to it.

Example Script:

let {newPage, end, except, extract, extractAndSave, store, runStore, waitFor} = __sandbox;
let {params, } = OPTIONS;
(async () => { try {
	// -- START --
	const page = await newPage();
	await page.goto('https://www.example.org');
	await page.saveSnapshot('example');
	await page.close();
	// -- END --
	end()
} catch(e) { except(e) } })();

Scrapex.ai Goto Script

Downloadable goto Project

Code Breakdown

The given snippet:

  • Opens a new page object using newPage()
  • Navigates to the the url https://www.example.org
  • Saves a page snapshot for the user to observe after execution
  • close the page.