puppeteer 1.0.1 copy "puppeteer: ^1.0.1" to clipboard
puppeteer: ^1.0.1 copied to clipboard

outdated

A high-level API to control headless Chrome over the DevTools Protocol. This is a port of Puppeteer in Dart.

example/example.dart

import 'package:logging/logging.dart';
import 'package:puppeteer/chrome_downloader.dart';
import 'package:puppeteer/puppeteer.dart';

// ignore_for_file: unused_local_variable

main() async {
  // Setup a logger if you want to see the raw chrome protocol
  Logger.root
    ..level = Level.ALL
    ..onRecord.listen(print);

  // Download a version of Chrome in a cache folder.
  // This is done by default when we don't provide a [executablePath] to
  // [Browser.start]
  var chromePath = (await downloadChrome()).executablePath;

  // You can specify the cache location and a specific version of chrome
  var chromePath2 =
      await downloadChrome(cachePath: '.chrome', revision: 497674);

  // Or just use an absolute path to an existing version of Chrome
  var chromePath3 =
      r'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';

  // Start the `Chrome` process and connect to the DevTools
  // By default it is start in `headless` mode
  var chrome = await Browser.start(executablePath: chromePath);

  // Open a new tab
  var myPage = await chrome.newPage();

  // Go to a page and wait to be fully loaded
  await myPage.goto('https://www.github.com', waitUntil: WaitUntil.networkIdle);

  // Do something... See other examples

  // Kill the process
  await chrome.close();
}
338
likes
0
pub points
91%
popularity

Publisher

verified publisherxaha.dev

A high-level API to control headless Chrome over the DevTools Protocol. This is a port of Puppeteer in Dart.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

archive, async, http, logging, meta, path, petitparser, pool

More

Packages that depend on puppeteer