I am using Chromeless 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.
In javascript I think I would need to use callback functions to prevent that but is there a better way to do this with Chromeless?