Browserless is a service that allows you to run headless Chrome instances in the cloud.
Go to siteThe Browserless API on Pipedream allows you to automate browser actions without the overhead of managing your own browser infrastructure. This service provides a way to run Chrome browser sessions programmatically, making it ideal for web scraping, automated testing, and screenshot capture. Leveraging this on Pipedream, you can create serverless workflows that interact with web pages, extract data, and perform actions as a human would, all in a scalable and efficient manner.
import puppeteer from 'puppeteer-core@14.1.0';
export default defineComponent({
props: {
browserless: {
type: "app",
app: "browserless",
}
},
async run({steps, $}) {
// See the browserless docs for more info:
// https://www.browserless.io/docs/
const browser = await puppeteer.connect({
browserWSEndpoint: `wss://chrome.browserless.io?token=${this.browserless.$auth.api_key}`
})
const page = await browser.newPage()
const url = "https://example.com"
const type = "png"
await page.goto(url)
const screenshot = await page.screenshot()
// export the base64-encoded screenshot for use in future steps,
// along with the image type and filename
$.export("screenshot", Buffer.from(screenshot, 'binary').toString('base64'))
$.export("type", type)
$.export("filename",`${url.replace(/[&\/\\#, +()$~%.'":*?<>{}]/g, '_')}-${+new Date()}.${type}`)
await browser.close()
},
})
Automated Website Testing: Employ Browserless to run end-to-end tests on your web application after deploying updates. Trigger these tests through Pipedream workflows whenever you push new code to your repository using a service like GitHub. Pipedream can process the results, and if tests fail, automatically notify your team via Slack or email.
Scheduled Website Screenshots: Set up a regular snapshot regime of your website or competitor websites by using Browserless to capture screenshots. Pipedream can schedule these actions and save the images to cloud storage platforms such as Google Drive or Dropbox. Use these snapshots to monitor visual changes or keep an archive of web page history.
Web Scraping for Data Analysis: Leverage Browserless to scrape data from websites that require JavaScript rendering. Pipedream can orchestrate this process, aggregate the data, and push it to data analysis tools such as Google Sheets or a database. This can be particularly useful for compiling market research or tracking price changes over time.
Browserless uses API keys for authentication. When you connect your Browserless account, Pipedream securely stores the keys so you can easily authenticate to Browserless APIs in both code and no-code steps.
Sign-up for a browserless account, it will create a unique token that allows service interaction.