npm.io
0.15.3 • Published 8 years ago

chrome-drone

Licence
MIT
Version
0.15.3
Deps
4
Vulns
3
Weekly
0
DeprecatedThis package is deprecated

Chrome Drone

npm version

Autonomously control the chrome browser

Minimum Chrome Version

You must have Chrome version 61.XX or greater installed

Installation

npm install chrome-drone

Sample Usage

const { createDrone, goTo, setValue, click, evaluate, waitForLoadingToFinish, kill } = require('chrome-drone');

async function stockPrice(symbol) {
  const drone  = await createDrone({headless: true});
  try {
    await goTo(drone, 'https://duckduckgo.com/');
    await setValue(drone, '#search_form_input_homepage', `stock quote ${symbol}`);
    await click(drone, '#search_button_homepage');
    await waitForLoadingToFinish(drone, 30000);
    const priceLastTrade = await evaluate(drone, `document.querySelector('span.stocks__quote.text--primary').innerText`);
    console.log(`Price of last trade: ${priceLastTrade}`);
  } finally {
    await kill(drone);
  }
}

stockPrice('QTWO');

API Documentation

API

Run Tests

npm test

Debugging options

  • drone-requests
  • drone-cookies
  • drone-blacklist
  • drone-loading

Keywords