-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
26 lines (21 loc) · 829 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
import { plugin } from 'selenium-with-fingerprints';
import { runAccountCreation } from './executor.js';
import { Logger } from './src/utils/logger.js';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const logger = new Logger('Runner');
const engineDir = path.join(__dirname, 'data', 'engine');
const run = async () => {
if (!fs.existsSync(engineDir)) {
logger.info('Initializing browser engine...');
const driver = await plugin.launch();
await driver.close();
logger.info('Browser engine downloaded successfully!');
}
logger.info('Starting automation...');
await runAccountCreation().catch(error => logger.error(`Automation failed: ${error.message}`));
};
await run();