255
This commit is contained in:
parent
9e3eabad7c
commit
8e45c0b89c
|
@ -139,7 +139,7 @@ async function WriteElement(selector, value,checkLocated = true, timeout = 3000)
|
||||||
await element.sendKeys(value);
|
await element.sendKeys(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function GetAttribute(selector, name, checkLocated = true, timeout = 3000)
|
async function GetAttribute(selector, name)
|
||||||
{
|
{
|
||||||
/**@type {WebDriver} */
|
/**@type {WebDriver} */
|
||||||
let tab = sys.get("currentDriver");
|
let tab = sys.get("currentDriver");
|
||||||
|
@ -151,17 +151,6 @@ async function GetAttribute(selector, name, checkLocated = true, timeout = 3000)
|
||||||
return await element.getAttribute(name)
|
return await element.getAttribute(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function GetAttribute(selector, name, checkLocated = true, timeout = 3000)
|
|
||||||
{
|
|
||||||
/**@type {WebDriver} */
|
|
||||||
let tab = sys.get("currentDriver");
|
|
||||||
if(checkLocated)
|
|
||||||
{
|
|
||||||
WaitElemen(selector, timeout)
|
|
||||||
};
|
|
||||||
let element = await tab.findElement(By.css(selector));
|
|
||||||
return await element.getAttribute(name)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function SubmitElement(selector, checkLocated = true, timeout = 3000)
|
async function SubmitElement(selector, checkLocated = true, timeout = 3000)
|
||||||
{
|
{
|
||||||
|
@ -182,6 +171,26 @@ async function Navigate(url)
|
||||||
await tab.get(url);
|
await tab.get(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function GoBack(url)
|
||||||
|
{
|
||||||
|
/**@type {WebDriver} */
|
||||||
|
let tab = sys.get("currentDriver");
|
||||||
|
await tab.navigate().back();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function GoForward(url)
|
||||||
|
{
|
||||||
|
/**@type {WebDriver} */
|
||||||
|
let tab = sys.get("currentDriver");
|
||||||
|
await tab.navigate().forward();
|
||||||
|
}
|
||||||
|
async function Refresh(url)
|
||||||
|
{
|
||||||
|
/**@type {WebDriver} */
|
||||||
|
let tab = sys.get("currentDriver");
|
||||||
|
await tab.navigate().refresh();
|
||||||
|
}
|
||||||
|
|
||||||
exports.sys = sys;
|
exports.sys = sys;
|
||||||
exports.StartSelenium = StartSelenium;
|
exports.StartSelenium = StartSelenium;
|
||||||
exports.ClickElement = ClickElement;
|
exports.ClickElement = ClickElement;
|
||||||
|
@ -198,3 +207,6 @@ exports.GoFirstTab = GoFirstTab;
|
||||||
exports.NextTab = NextTab;
|
exports.NextTab = NextTab;
|
||||||
exports.PrevTab = PrevTab;
|
exports.PrevTab = PrevTab;
|
||||||
exports.GetCurrentTabIndex = GetCurrentTabIndex;
|
exports.GetCurrentTabIndex = GetCurrentTabIndex;
|
||||||
|
exports.GoBack = GoBack;
|
||||||
|
exports.GoForward = GoForward;
|
||||||
|
exports.Refresh = Refresh;
|
10
index.js
10
index.js
|
@ -20,7 +20,10 @@ const {
|
||||||
GoFirstTab,
|
GoFirstTab,
|
||||||
NextTab,
|
NextTab,
|
||||||
PrevTab,
|
PrevTab,
|
||||||
GetCurrentTabIndex
|
GetCurrentTabIndex,
|
||||||
|
GoBack,
|
||||||
|
GoForward,
|
||||||
|
Refresh
|
||||||
} = require("./Core/index");
|
} = require("./Core/index");
|
||||||
|
|
||||||
async function runFile(file)
|
async function runFile(file)
|
||||||
|
@ -41,7 +44,10 @@ async function runFile(file)
|
||||||
GoFirstTab,
|
GoFirstTab,
|
||||||
NextTab,
|
NextTab,
|
||||||
PrevTab,
|
PrevTab,
|
||||||
GetCurrentTabIndex
|
GetCurrentTabIndex,
|
||||||
|
GoBack,
|
||||||
|
GoForward,
|
||||||
|
Refresh
|
||||||
});
|
});
|
||||||
let scope = await runInContext(fileContext + '\n\nmain();', context);
|
let scope = await runInContext(fileContext + '\n\nmain();', context);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue