How to use Params in Scripts

Scripts can make use of run-time parameters. These are defined during the script design time with default values. These values can be overriden at each run using the dropdown provided next to the run button.

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(params.url)
	await page.saveSnapshot('snap')
	await store.saveOne(params.storeName, {id: 1, data:})
	// -- END --
} catch(e) { except(e) } })(); Params Script

Downloadable params Project

Code Breakdown

The given snippet:

  • Logs all the params recieved
  • Opens a new page using the newPage() method
  • Navigate to the url provided in params as url key
  • Save a snapshot of the page with the name given in params as snap key
  • Store data to project-level store with the param storeName key