schickling/chromeless

Wait end of previous command before executing next one

stephanedebove opened this issue · 0 comments

This is a Feature Proposal

Description

Is it possible to add a function to execute javascript code only when the previous command has finished? I come from Casperjs and it's very easy to code this there as commands are executed one after the other, no asynchronous commands.

If not possible, a simple example of how to set up a callback function in chromeless would be nice.

(More specifically, I'm trying to retrieve a piece of information on a website and load a corresponding file:

async function run() {
  const chromeless = new Chromeless()

      const screenshot = await chromeless
        .goto('http://www.website.com')
         title = await chromeless.inputValue('input[name="title"]')

         var fs = require('fs');
         var data = fs.readFileSync(title,"utf8");
         ...
    await chromeless.end()
}

but the file read instructions are executed immediately when I launch the script and do not wait for the web crawling to be finished.

Additional Data

  • Chromeless Version you're using:
    1.4.0
  • Operating System:
    windows 10