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);
|
||||
}
|
||||
|
||||
async function GetAttribute(selector, name, checkLocated = true, timeout = 3000)
|
||||
async function GetAttribute(selector, name)
|
||||
{
|
||||
/**@type {WebDriver} */
|
||||
let tab = sys.get("currentDriver");
|
||||
|
@ -151,17 +151,6 @@ async function GetAttribute(selector, name, checkLocated = true, timeout = 3000)
|
|||
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)
|
||||
{
|
||||
|
@ -182,6 +171,26 @@ async function Navigate(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.StartSelenium = StartSelenium;
|
||||
exports.ClickElement = ClickElement;
|
||||
|
@ -197,4 +206,7 @@ exports.GoLastTab = GoLastTab;
|
|||
exports.GoFirstTab = GoFirstTab;
|
||||
exports.NextTab = NextTab;
|
||||
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,
|
||||
NextTab,
|
||||
PrevTab,
|
||||
GetCurrentTabIndex
|
||||
GetCurrentTabIndex,
|
||||
GoBack,
|
||||
GoForward,
|
||||
Refresh
|
||||
} = require("./Core/index");
|
||||
|
||||
async function runFile(file)
|
||||
|
@ -41,7 +44,10 @@ async function runFile(file)
|
|||
GoFirstTab,
|
||||
NextTab,
|
||||
PrevTab,
|
||||
GetCurrentTabIndex
|
||||
GetCurrentTabIndex,
|
||||
GoBack,
|
||||
GoForward,
|
||||
Refresh
|
||||
});
|
||||
let scope = await runInContext(fileContext + '\n\nmain();', context);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue