GithubHelp home page GithubHelp logo

automatonic's People

Contributors

evs-chris avatar tuefekci avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

automatonic's Issues

still maintaining?

I was just poking around looking for solutions to automate an electron app. Are you still maintaining/using this?

In the readme you mention:

You can't use Nightmare.js from within an Electron app.

But it looks like this is no longer the case

automatonic not working in app 'ready' event

Hi. im using electron v1.6.11
when i using Auto function outside app.on('ready',...) it work OK, but i using auto inside it, it not working

Here is my code:

const {app, BrowserWindow} = require('electron')
const path = require('path')
const url = require('url')
const { Browser, run, sleep } = require('automatonic');

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let win;
function Auto(){
	console.log("begin");
	run(function*() {
	  const I = new Browser();
		console.log("start");
	  I.goto('https://google.com');
	 
	  // let's give 'em a second to settle 
	  yield sleep(1000);
	 
	  // do a search 
	  I.type('#lst-ib', 'automatonic\n');
	  I.click('button[name=btnG]');
	 
	  // wait for a result and grab its title 
	  I.waitFor('h3.r a');
	  const first = yield I.execute(function() {
	    return document.querySelector('h3.r a').innerText;
	  });
	 
	  if (~first.toLowerCase().indexOf('wikipedia')) {
	    console.log("hey look, it's a Wikipedia link");
	  } else {
	    console.log("it's not a Wikipedia link, let's click it");
	    I.click('h3.r a');
	  }
	 
	  yield sleep(20000);
	  I.close();
	}).then(null, err => {
	  console.error('OH NOES!', err);
	});
}



// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', ()=>{
	Auto(); // it not work!
})

// Quit when all windows are closed.
app.on('window-all-closed', () => {
  // On macOS it is common for applications and their menu bar
  // to stay active until the user quits explicitly with Cmd + Q
  if (process.platform !== 'darwin') {
    app.quit()
  }
})
//Auto(); //it work

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.