Beispiel #1
0
        public static void ScrollToElement(IWebDriver driver, IWebElement element)
        {
            IWebElement elem = driver.FindElement(By.CssSelector(Helpers.GetElementCssSelector(driver, element)));

            ((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView(true);", elem);
        }
Beispiel #2
0
 //best-click
 public static void WaitAndClickElement(IWebDriver driver, IWebElement element)
 {
     try
     {
         Helpers.WaitForLocatorLoad(driver, By.CssSelector(Helpers.GetElementCssSelector(driver, element)));
         Helpers.FindElement(driver, element);
         new Actions(driver).MoveToElement(element).Build().Perform();
         Helpers.ScrollToElement(driver, element);
         Helpers.ClickElementSafly(driver, element);
     }
     catch (Exception ex)
     {
         Assert.Fail("Helpers method 'WaitAndClickElement' was failed.\nElement:\n" + Helpers.GetElementCssSelector(driver, element) + "\nTest fail due to: {0}, {1}, {2}", ex.Message, ex.InnerException, ex);
     }
 }