public static void Refresh() { LoggerSelenium.LogStart(System.Reflection.MethodBase.GetCurrentMethod().Name); DriverSingleton.Driver.Navigate().Refresh(); Wait.ForDocumentLoaded(); LoggerSelenium.LogEnd(System.Reflection.MethodBase.GetCurrentMethod().Name); }
public void ClearStorage() { LoggerSelenium.LogStart(System.Reflection.MethodBase.GetCurrentMethod().Name); JsExecutor.ClearSessionStorage(); Wait.FromSeconds(1); LoggerSelenium.LogEnd(System.Reflection.MethodBase.GetCurrentMethod().Name); }
public static void ForRollerOnReportsToGoAway() { LoggerSelenium.LogStart(System.Reflection.MethodBase.GetCurrentMethod().Name); ForDocumentLoaded(); ForElementToLeave(ReportLocators.Spinner, DriverConsts.FourMinInMilliseconds); LoggerSelenium.LogEnd(System.Reflection.MethodBase.GetCurrentMethod().Name); }
public static void ForRollersToGoAway() { LoggerSelenium.LogStart(System.Reflection.MethodBase.GetCurrentMethod().Name); ForDocumentLoaded(); ForElementToLeave(By.CssSelector(@"div[class='lds-roller'] [style='display:block']")); LoggerSelenium.LogEnd(System.Reflection.MethodBase.GetCurrentMethod().Name); }
public static void Clear(By locator) { LoggerSelenium.LogStart(MethodBase.GetCurrentMethod().Name, locator); Wait.StandardWait(); DriverSingleton.Driver.FindElement(locator).Clear(); LoggerSelenium.LogEnd(MethodBase.GetCurrentMethod().Name, locator); }
public void SendKeys(By locator, string value) { LoggerSelenium.LogStart(MethodBase.GetCurrentMethod().Name, locator, value); Wait.StandardWait(); DriverSingleton.Driver.FindElement(locator).SendKeys(value); LoggerSelenium.LogEnd(MethodBase.GetCurrentMethod().Name, locator, value); }
public static void ClearCookiesAndCloseBrowser() { LoggerSelenium.LogStart(System.Reflection.MethodBase.GetCurrentMethod().Name); DriverSingleton.Driver.Manage().Cookies.DeleteAllCookies(); DriverSingleton.Dispose(); LoggerSelenium.LogEnd(System.Reflection.MethodBase.GetCurrentMethod().Name); }
public void OpenMiDashboardPage() { LoggerSelenium.LogStart(System.Reflection.MethodBase.GetCurrentMethod().Name); Navigate.ToMiDashboard(); this.miDashboardPage.WaitForMiDashboardLoaded(); LoggerSelenium.LogEnd(System.Reflection.MethodBase.GetCurrentMethod().Name); }
public void Click(By locator, int index = 0) { LoggerSelenium.LogStart(MethodBase.GetCurrentMethod().Name, locator); Wait.StandardWait(); DriverSingleton.Driver.FindElements(locator)[index].Click(); LoggerSelenium.LogEnd(MethodBase.GetCurrentMethod().Name, locator); }
public static void Until(Func <IWebDriver, IWebElement> condition) { LoggerSelenium.LogStart(System.Reflection.MethodBase.GetCurrentMethod().Name); WebDriverWait wait = new WebDriverWait(DriverSingleton.Driver, TimeSpan.FromSeconds(DriverConsts.Twenty)); wait.Until(condition); LoggerSelenium.LogEnd(System.Reflection.MethodBase.GetCurrentMethod().Name); }
public static void Until(Func <IWebDriver, bool> condition) { LoggerSelenium.LogStart(System.Reflection.MethodBase.GetCurrentMethod().Name); var wait = new WebDriverWait(DriverSingleton.Driver, new TimeSpan(0, 0, DriverConsts.Twenty)); wait.Until(condition); LoggerSelenium.LogEnd(System.Reflection.MethodBase.GetCurrentMethod().Name); }
public void MouseOverJs(IWebElement element) { LoggerSelenium.LogStart(MethodBase.GetCurrentMethod().Name, element); Wait.StandardWait(); JsExecutor.MouseOver(element); LoggerSelenium.LogEnd(MethodBase.GetCurrentMethod().Name, element); }
public void ClickByJs(By locator, int index = 0, int scroll = -90) { LoggerSelenium.LogStart(MethodBase.GetCurrentMethod().Name, locator, index); JsExecutor.ScrollIntoView(locator); JsExecutor.ScrollBy(scroll); JsExecutor.Click(locator, index); LoggerSelenium.LogEnd(MethodBase.GetCurrentMethod().Name, locator, index); }
public void Click(IWebElement element) { LoggerSelenium.LogStart(MethodBase.GetCurrentMethod().Name); Wait.StandardWait(); element.Click(); LoggerSelenium.LogEnd(MethodBase.GetCurrentMethod().Name); }
public static void ForDocumentLoaded() { LoggerSelenium.LogStart(System.Reflection.MethodBase.GetCurrentMethod().Name); var wait = SetWaitTime(DriverConsts.ThreeMinInMilliseconds); wait.Until(d => JsExecutor.DocumentComplete()); LoggerSelenium.LogEnd(System.Reflection.MethodBase.GetCurrentMethod().Name); }
public void SendKeysByJs(By locator, string value) { LoggerSelenium.LogStart(MethodBase.GetCurrentMethod().Name, locator, value); Wait.StandardWait(); JsExecutor.SendKeys(locator, value); JsExecutor.CallEventOnElement(locator); LoggerSelenium.LogEnd(MethodBase.GetCurrentMethod().Name, locator, value); }
public static void ForRollersOnWidgetsToGoAway() { LoggerSelenium.LogStart(System.Reflection.MethodBase.GetCurrentMethod().Name); ForDocumentLoaded(); ForElementToLeave( By.CssSelector(@"div[class='spinner--overlay'] div[class='lds-roller']"), DriverConsts.ThreeMinInMilliseconds); LoggerSelenium.LogEnd(System.Reflection.MethodBase.GetCurrentMethod().Name); }
public static void ForElement(By locator, int milliseconds = DriverConsts.TwoMinInMilliseconds) { LoggerSelenium.LogStart(System.Reflection.MethodBase.GetCurrentMethod().Name, locator, milliseconds); StandardWait(); WebDriverWait wait = new WebDriverWait( DriverSingleton.Driver, TimeSpan.FromMilliseconds(milliseconds)); wait.IgnoreExceptionTypes(typeof(NoSuchElementException)); wait.Until(ExpectedConditions.ElementExists(locator)); LoggerSelenium.LogEnd(System.Reflection.MethodBase.GetCurrentMethod().Name, locator, milliseconds); }
public static void MouseOver(IWebElement element) { LoggerSelenium.LogStart(MethodBase.GetCurrentMethod().Name, element); ExecuteScript( @" if (document.createEvent) { var evObj = document.createEvent('MouseEvents'); evObj.initEvent('mouseover', true, false); arguments[0].dispatchEvent(evObj); } else if (document.createEventObject) { arguments[0].fireEvent('onmouseover'); }", element); LoggerSelenium.LogEnd(MethodBase.GetCurrentMethod().Name, element); }
public static void CallEventOnElement(By locator) { LoggerSelenium.LogStart(MethodBase.GetCurrentMethod().Name, locator); // ExecuteScript($@"arguments[0].dispatchEvent(new Event('input')", locator); // ExecuteScript($@"arguments[0].dispatchEvent(new Event('change')", locator); ExecuteScript( @" var createEvent = function ieEventPolyfill(eventName) { var event = document.createEvent('Event'); event.initEvent(eventName, true, true); return event; } arguments[0].dispatchEvent(createEvent('keyup')); arguments[0].dispatchEvent(createEvent('input'));", locator); LoggerSelenium.LogEnd(MethodBase.GetCurrentMethod().Name, locator); }