From 8e45c0b89cd50d2049df7e19ff0e6bc2e27db4c6 Mon Sep 17 00:00:00 2001 From: Abdussamed Date: Sun, 19 Mar 2023 14:11:08 +0300 Subject: [PATCH] 255 --- Core/index.js | 38 +++++++++++++++++++++++++------------- index.js | 10 ++++++++-- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/Core/index.js b/Core/index.js index 4936b0c..a39f8d7 100644 --- a/Core/index.js +++ b/Core/index.js @@ -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; \ No newline at end of file +exports.GetCurrentTabIndex = GetCurrentTabIndex; +exports.GoBack = GoBack; +exports.GoForward = GoForward; +exports.Refresh = Refresh; \ No newline at end of file diff --git a/index.js b/index.js index c21711a..8a7011b 100644 --- a/index.js +++ b/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); }