49 lines
977 B
JavaScript
49 lines
977 B
JavaScript
const fs = require("fs");
|
|
const path = require("path");
|
|
const {
|
|
createContext,
|
|
runInContext
|
|
} = require("vm");
|
|
|
|
const {
|
|
StartSelenium,
|
|
ClearElement,
|
|
ClickElement,
|
|
CreateTab,
|
|
GetAttribute,
|
|
SubmitElement,
|
|
WaitElement,
|
|
WriteElement,
|
|
Navigate,
|
|
goTab,
|
|
GoLastTab,
|
|
GoFirstTab,
|
|
NextTab,
|
|
PrevTab,
|
|
GetCurrentTabIndex
|
|
} = require("./Core/index");
|
|
|
|
async function runFile(file)
|
|
{
|
|
let fileContext = fs.readFileSync(path.resolve(file),"utf-8");
|
|
let context = createContext({
|
|
StartSelenium,
|
|
ClearElement,
|
|
ClickElement,
|
|
CreateTab,
|
|
GetAttribute,
|
|
SubmitElement,
|
|
WaitElement,
|
|
WriteElement,
|
|
Navigate,
|
|
goTab,
|
|
GoLastTab,
|
|
GoFirstTab,
|
|
NextTab,
|
|
PrevTab,
|
|
GetCurrentTabIndex
|
|
});
|
|
let scope = await runInContext(fileContext + '\n\nmain();', context);
|
|
}
|
|
|
|
process.nextTick(runFile,"./projects/index.js"); |