All Projects → qieguo2016 → doffy

qieguo2016 / doffy

Licence: MIT license
a web auto run lib base on chrome headless

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to doffy

Jvppeteer
Headless Chrome For Java (Java 爬虫)
Stars: ✭ 193 (+1384.62%)
Mutual labels:  chrome-headless
Codeceptjs
Supercharged End 2 End Testing Framework for NodeJS
Stars: ✭ 3,592 (+27530.77%)
Mutual labels:  nightmare
JSS-Resource-Tools
A CLI utility that utilises the Jamf Pro (previously Casper Suite) API in order to import, export and update JSS resources en-masse.
Stars: ✭ 24 (+84.62%)
Mutual labels:  casper
Puppeteer Renderer
Puppeteer(Chrome headless node API) based web page renderer
Stars: ✭ 214 (+1546.15%)
Mutual labels:  chrome-headless
website-to-json
Converts website to json using jQuery selectors
Stars: ✭ 37 (+184.62%)
Mutual labels:  nightmare
geist
Casper 2.0 theme for WordPress.
Stars: ✭ 23 (+76.92%)
Mutual labels:  casper
Dockerfiles
Various dockerfiles including chrome-headless, lighthouse and other tooling.
Stars: ✭ 180 (+1284.62%)
Mutual labels:  chrome-headless
ember-app-shell
No description or website provided.
Stars: ✭ 23 (+76.92%)
Mutual labels:  chrome-headless
shadowgate
Mirror of ShadowGate code
Stars: ✭ 12 (-7.69%)
Mutual labels:  nightmare
Viewfinder
📷 BrowserBox - Remote isolated browser API for security, automation visibility and interactivity. Run on our cloud, or bring your own. Full scope double reverse web proxy with multi-tab, mobile-ready browser UI frontend. Plus co-browsing, advanced adaptive streaming, secure document viewing and more! But only in the Pro version. Get BB today! Se…
Stars: ✭ 1,741 (+13292.31%)
Mutual labels:  chrome-headless
Simple Headless Chrome
Simple abstraction to use Chrome as a Headless Browser with Node JS
Stars: ✭ 216 (+1561.54%)
Mutual labels:  chrome-headless
Cdp4j
cdp4j - Chrome DevTools Protocol for Java
Stars: ✭ 232 (+1684.62%)
Mutual labels:  chrome-headless
doo-chrome-devprotocol
A runner for doo which runs tests in Chrome, using the Chrome Dev Protocol with no need for karma or npm.
Stars: ✭ 27 (+107.69%)
Mutual labels:  chrome-headless
Thal
Getting started with Puppeteer and Chrome Headless for Web Scraping
Stars: ✭ 2,345 (+17938.46%)
Mutual labels:  chrome-headless
marathon
Cross-platform test runner written for Android and iOS projects
Stars: ✭ 398 (+2961.54%)
Mutual labels:  uitest
Api
API that uncovers the technologies used on websites and generates thumbnail from screenshot of website
Stars: ✭ 189 (+1353.85%)
Mutual labels:  chrome-headless
cbc-casper-js
JS implementation of Vlad Zamfir's CBC Casper TFG
Stars: ✭ 21 (+61.54%)
Mutual labels:  casper
puppeteer-loadtest
load test puppeteer (Headless Chrome API) script using node
Stars: ✭ 107 (+723.08%)
Mutual labels:  chrome-headless
ghost-theme-casperion
Casperion is a free Ghost theme. Casperion is based upon original Ghost theme Casper with some minor modifications and extensions.
Stars: ✭ 27 (+107.69%)
Mutual labels:  casper
xappium.uitest
Xappium.UITest is a UITest helper framework built on top of Appium. This aims at making it easier to write and run UI Tests.
Stars: ✭ 60 (+361.54%)
Mutual labels:  uitest

doffy

CircleCI npm GitHub stars GitHub license

Doffy a headless browser automation library with easy-use API.

Doffy provide a few simple methods to simulate user action like goto click fill, which are useful for headless web testing and crawling.

Feature

  • Base on chrome headless, use Chrome Devtools Protocol, while Nightmare base on Electron and Casper is base on PhantomJS.
  • All Promise, all API of Doffy return a Promise

QuickStart

install chrome headless

Mac: chrome headless is shipped on chrome-canary, install: https://www.google.com/chrome/browser/canary.html

Linux: chrome headless is also shipped on chrome 59. so you can install chrome 59 to use headless mode.

# https://askubuntu.com/questions/79280/how-to-install-chrome-browser-properly-via-command-line
sudo apt-get install libxss1 libappindicator1 libindicator7
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome*.deb  # Might show "errors", fixed by next line
sudo apt-get install -f

install doffy

# wait for npm publish

page automation:

import Doffy from '../src/doffy';
const doffy = new Doffy();

(async() => {
  await doffy.init();
  await doffy.goto('https://github.com/login');
  await doffy.screenshot('result/01-homepage.jpeg');
  await doffy.fill('#login_field', 'doffyjs');
  await doffy.fill('#password', 'doffy2017');
  await doffy.screenshot('result/02-fillaccount.jpeg');
  await doffy.click('[name="commit"]');
  await doffy.wait('.avatar');
  let isLogin = await doffy.visible('.avatar')
  isLogin && console.log('======== login success ========');
  await doffy.end(true);
})();

run mocha test

import Doffy from '../src/doffy';

const expect = require('chai').expect;
const doffy = new Doffy();

describe('test example', function() {

  before(async function() {
    try {
      await doffy.init();
      console.log('======== test begin ========');
    } catch(err) {
      console.error('error happen while init doffy', err);
    }
  });

  after(async function() {
    // runs after all tests in this block
    await doffy.end(true);
    console.log('====== test end ======');
  });

  it('open home page', async function() {
    await doffy.goto('https://www.baidu.com');
    let ret = await doffy.title();
    expect(ret.result.value).to.be.equal("百度一下,你就知道");
    await doffy.screenshot('temp/01.jpeg');
  });

  it('open signin dialog', async function() {
    await doffy.fill('#kw', 'github');
    await doffy.click('#su');
    let firstResult = await doffy.evaluate(() => {
      return document.querySelectorAll('.result h3')[0].innerText;
    });
    expect(firstResult).to.be.equal('GitHub · Build software better, together.官网');
    await doffy.screenshot('temp/02.jpeg');
  });

});

API

see wiki page => API doc please wait...

ChangeLog

2017.05.12

  • New

LICENSE

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].