This commit is contained in:
Abdussamed 2023-03-19 14:11:08 +03:00
parent 9e3eabad7c
commit 8e45c0b89c
2 changed files with 33 additions and 15 deletions

View File

@ -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;
@ -197,4 +206,7 @@ exports.GoLastTab = GoLastTab;
exports.GoFirstTab = GoFirstTab; 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;

View File

@ -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);
} }