export declare const searchExample = "// Full TypeScript support for both puppeteer and the DOM\nexport default async ({ page }: { page: Page }) => {\n\n // Full puppeteer API is available\n await page.goto('https://google.com/');\n await page.type('textarea', 'browserless.io');\n await Promise.all([\n page.keyboard.press('Enter'),\n page.waitForNavigation(),\n ]);\n\n // Logs show up in the browser's devtools\n console.log(`I show up in the page's console!`);\n\n const topLinks = await page.evaluate(() => {\n const results = [...document.querySelectorAll('#search a')] as HTMLElement[];\n return [...results].map(el => [el.innerText, el.getAttribute('href')]);\n });\n\n // Can pause by injecting a \"debugger;\" statement. Uncomment to see the magic\n // await page.evaluate(() => { debugger; });\n\n console.table(topLinks);\n};"; export declare const screenshotExample = "// Let's load up a cool dashboard and screenshot it!\nexport default async ({ page }: { page: Page }) => {\n await page.goto('https://play.grafana.org/d/000000029/prometheus-demo-dashboard?orgId=1&refresh=5m&kiosk', { waitUntil: 'networkidle0'});\n\n // Enlarge the viewport so we can capture it.\n await page.setViewport({ width: 1920, height: 1080 });\n\n // Return the screenshot buffer which will trigger this editor to download it.\n return page.screenshot({ fullPage: true });\n};"; export declare const pdfExample = "// For PDFs, let's take some API content and inject some simple styles\nexport default async ({ page }: { page: Page }) => {\n\n // Let's get React's documentation and scrape out\n // their actual API docs without all the other stuff.\n await page.goto('https://reactjs.org/docs/react-api.html');\n const apiContent = await page.evaluate(() => document.querySelector('article').innerHTML);\n\n // Now, let's get some simple markdown CSS for print\n await page.goto('https://raw.githubusercontent.com/simonlc/Markdown-CSS/master/markdown.css');\n const stylesheet = await page.evaluate(() => document.body.innerText);\n\n // Finally, let's inject the above in a blank page and print it.\n await page.goto('about:blank');\n await page.setContent(apiContent);\n await page.addStyleTag({ content: stylesheet });\n \n // Return a PDF buffer to trigger the editor to download.\n return page.pdf();\n};"; export declare const scrapeExample = "// In this example, we'll scrape links on HN\nexport default async ({ page }: { page: Page }) => {\n await page.goto('https://news.ycombinator.com');\n\n // Here, we inject some JavaScript into the page to build a list of results\n const items = await page.evaluate(() => {\n const elements = [...document.querySelectorAll('.athing a')];\n const results = elements.map((el: HTMLAnchorElement) => ({\n title: el.textContent,\n href: el.href,\n }));\n return JSON.stringify(results);\n });\n\n // Finally, we return an object, which triggers a JSON file download\n return JSON.parse(items);\n};"; export declare const blankExample = "export default async ({ page }: { page: Page }) => {\n // Do Something with the page and return!\n // The editor will detect the return value, and either download\n // a JSON/PDF/PNG or Plain-text file. If you don't return\n // anything then nothing will happen.\n};"; export declare const indexCode = "const { default: start } = require('./start.js');\nconst puppeteer = require('puppeteer-core');\n\n(async () => {\n const browser = await puppeteer.connect({\n browserWSEndpoint: 'wss://chrome.browserless.io'\n });\n const page = await browser.newPage();\n\n await start({ page, browser });\n\n return browser.close();\n})()\n.then(() => console.log('Script complete!'))\n.catch((err) => console.error('Error running script' + err));";