JSPM

  • Created
  • Published
  • Downloads 52
  • Score
    100M100P100Q66682F
  • License MIT

Puppeteer alternative for Chrome extensions. A module for Chrome extensions that functions similarly to Puppeteer.

Package Exports

  • browser-automator
  • browser-automator/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (browser-automator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

browser-automator
NPM Version Publish Size Downloads License: MIT

Puppeteer alternative for Chrome extensions.

A module for Chrome extensions that functions similarly to Puppeteer. The main purpose of this module is to provide a convenient and easy-to-use interface for interacting with a web page through Chrome's extension APIs. This TypeScript-based node module provides a comprehensive and convenient way of interacting with a web page through Chrome's browser automation APIs. Whether you need to navigate to a specific URL, execute JavaScript code, or wait for specific conditions to be met, this module has got you covered.

Table of Contents

Install

npm i browser-automator

Usage

A minimal example to automate Goolge search:

import automator from 'browser-automator'

const browser = automator.launch()

const page = await browser.newPage({ tabOptions: { url: 'https://www.google.com' } })
await page.waitForSelector('input[type="text"]')
await page.input('input[type="text"]', 'Hello word!')
await page.click('input[type="submit"]')

Available Methods

  • goto: Navigate to a target URL and wait for the page to load.

  • reload: Reload the current page.

  • url: Get the URL of the current page.

  • close: Close the current page.

  • bringToFront: Bring the current page to the front of the window.

  • hideFromFront: Hide the current page from the front of the window.

  • evaluate: Execute a JavaScript function in the context of the current page.

  • waitFor: Wait for a specific condition to be met by periodically checking the result of a JavaScript function.

  • waitForNavigation: Wait for the URL of the current page to change.

  • waitForSelector: Wait for a specific DOM element to be present on the page.

  • waitForSelectorMiss: Wait for a specific DOM element to be absent from the page.

  • waitForXPath: Wait for a specific XPath expression to match a DOM element on the page.

Contributing

You are welcome to contribute! If you are adding a feature or fixing a bug, please contribute to the GitHub repository.

License

browser-automator is licensed under the MIT license.

Author

@SheikhAminul
@SheikhAminul