UNPKG

cooldriverio

Version:

Cool webdriver io automation, yes, test automation automation.

71 lines (63 loc) 1.45 kB
// const parser = [ // { // name: 'url', // url: true, // selector: false, // }, // { // name: 'waitForExist', // url: false, // selector: true, // }, // { // name: 'click', // url: false, // selector: true, // }, // ] // // const commands = [ // { // name: 'url', // selector: 'https://cagataycali.xyz', // }, // { // name: 'waitForExist', // selector: 'https://cagataycali.xyz', // }, // { // name: 'cagatay', // selector: 'https://cagataycali.xyz', // }, // ]; // // // TODO @like scrape-it import Client from './app/cooldriver'; import config from './app/config.js'; var runner = require('selenium-run'); class ClientRunner { async run(directives) { const webdriver = new Client(config); await webdriver.init(); // Directives. console.log(directives); await webdriver.run(); } } module.exports = function(directives) { return new Promise(function(resolve, reject) { runner.run(); console.log('Selenium runned.'); const main = new ClientRunner(); setTimeout(function () { main.run(directives) .then((value) => { console.log('Codes runned'); runner.kill() .then(function (value) {console.log('Selenium killed');process.exit();}) .catch(function (error) {console.log(error);}) }) .catch((err) => {console.log(err);}) }, 2000); }); }