2023-03-19 13:55:55 +03:00
|
|
|
const fs = require("fs");
|
2023-03-19 14:30:20 +03:00
|
|
|
const {resolve} = require("path");
|
2023-03-19 13:55:55 +03:00
|
|
|
const {
|
|
|
|
createContext,
|
|
|
|
runInContext
|
|
|
|
} = require("vm");
|
|
|
|
const {
|
|
|
|
StartSelenium,
|
|
|
|
ClearElement,
|
|
|
|
ClickElement,
|
|
|
|
CreateTab,
|
|
|
|
GetAttribute,
|
|
|
|
SubmitElement,
|
|
|
|
WaitElement,
|
|
|
|
WriteElement,
|
|
|
|
Navigate,
|
|
|
|
goTab,
|
|
|
|
GoLastTab,
|
|
|
|
GoFirstTab,
|
|
|
|
NextTab,
|
|
|
|
PrevTab,
|
2023-03-19 14:11:08 +03:00
|
|
|
GetCurrentTabIndex,
|
|
|
|
GoBack,
|
|
|
|
GoForward,
|
|
|
|
Refresh
|
2023-03-19 13:55:55 +03:00
|
|
|
} = require("./Core/index");
|
2023-03-19 14:30:20 +03:00
|
|
|
const {
|
|
|
|
knex
|
|
|
|
} = require("knex");
|
|
|
|
|
|
|
|
const DB = knex({
|
|
|
|
client: "sqlite3",
|
|
|
|
connection:{
|
|
|
|
filename: resolve("./data/database.db")
|
|
|
|
}
|
|
|
|
});
|
2023-03-19 13:55:55 +03:00
|
|
|
|
|
|
|
async function runFile(file)
|
|
|
|
{
|
2023-03-19 14:30:20 +03:00
|
|
|
let fileContext = fs.readFileSync(resolve(file),"utf-8");
|
2023-03-19 13:55:55 +03:00
|
|
|
let context = createContext({
|
|
|
|
StartSelenium,
|
|
|
|
ClearElement,
|
|
|
|
ClickElement,
|
|
|
|
CreateTab,
|
|
|
|
GetAttribute,
|
|
|
|
SubmitElement,
|
|
|
|
WaitElement,
|
|
|
|
WriteElement,
|
|
|
|
Navigate,
|
|
|
|
goTab,
|
|
|
|
GoLastTab,
|
|
|
|
GoFirstTab,
|
|
|
|
NextTab,
|
|
|
|
PrevTab,
|
2023-03-19 14:11:08 +03:00
|
|
|
GetCurrentTabIndex,
|
|
|
|
GoBack,
|
|
|
|
GoForward,
|
2023-03-19 14:30:20 +03:00
|
|
|
Refresh,
|
|
|
|
DB
|
2023-03-19 13:55:55 +03:00
|
|
|
});
|
2023-03-19 14:30:20 +03:00
|
|
|
await runInContext(fileContext + '\n\nmain();', context);
|
2023-03-19 13:55:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
process.nextTick(runFile,"./projects/index.js");
|