コード例 #1
0
ファイル: Utilities.cs プロジェクト: zaurik/SeShell
        /// <summary>
        /// Finds the element.
        /// </summary>
        /// <param name="driver">The driver.</param>
        /// <param name="by">The by.</param>
        /// <param name="element">The element.</param>
        /// <returns></returns>
        public static IWebElement FindElement(IWebDriver driver, HtmlElementBy by, string element)
        {
            switch (by)
            {
            case HtmlElementBy.Id:
                return(driver.FindElement(By.Id(element)));

            case HtmlElementBy.XPath:
                return(driver.FindElement(By.XPath(element)));

            case HtmlElementBy.ClassName:
                return(driver.FindElement(By.ClassName(element)));

            case HtmlElementBy.Name:
                return(driver.FindElement(By.Name(element)));

            default:
                return(null);
            }
        }
コード例 #2
0
ファイル: Utilities.cs プロジェクト: zaurik/SeShell
        /// <summary>
        /// Finds the element.
        /// </summary>
        /// <param name="parentElement">The parent element.</param>
        /// <param name="by">The by.</param>
        /// <param name="element">The element.</param>
        /// <returns></returns>
        public static IWebElement FindElement(IWebElement parentElement, HtmlElementBy by, string element)
        {
            switch (by)
            {
            case HtmlElementBy.Id:
                return(parentElement.FindElement(By.Id(element)));

            case HtmlElementBy.XPath:
                return(parentElement.FindElement(By.XPath(element)));

            case HtmlElementBy.ClassName:
                return(parentElement.FindElement(By.ClassName(element)));

            case HtmlElementBy.Name:
                return(parentElement.FindElement(By.Name(element)));

            case HtmlElementBy.CssSelector:
                return(parentElement.FindElement(By.CssSelector(element)));

            default:
                return(null);
            }
        }
コード例 #3
0
ファイル: Utilities.cs プロジェクト: harindu61/twitterTest
        public static void WaitTillSelected(IWebDriver webDriver, HtmlElementBy by, string elementIdentifier, int timeInSeconds)
        {
            WebDriverWait wait = new WebDriverWait(webDriver, TimeSpan.FromSeconds(timeInSeconds));

            switch (by)
            {
                case HtmlElementBy.Id:
                    wait.Until(d => d.FindElement(By.Id(elementIdentifier)).Selected);
                    break;
                case HtmlElementBy.Name:
                    wait.Until(d => d.FindElement(By.Name(elementIdentifier)).Selected);
                    break;
                case HtmlElementBy.XPath:
                    wait.Until(d => d.FindElement(By.XPath(elementIdentifier)).Selected);
                    break;
                case HtmlElementBy.ClassName:
                    wait.Until(d => d.FindElement(By.ClassName(elementIdentifier)).Selected);
                    break;
                case HtmlElementBy.CssSelector:
                    wait.Until(d => d.FindElement(By.CssSelector(elementIdentifier)).Selected);
                    break;
                default:
                    throw new NotImplementedException();
            }
        }
コード例 #4
0
ファイル: Utilities.cs プロジェクト: harindu61/twitterTest
 public static void WaitTillEnabled(IWebDriver webDriver, HtmlElementBy by, string elementIdentifier)
 {
     WaitTillEnabled(webDriver, by, elementIdentifier, Configuration.WebDriverWaitTimeOut);
 }
コード例 #5
0
ファイル: Utilities.cs プロジェクト: harindu61/twitterTest
 /// <summary>
 /// Finds the element.
 /// </summary>
 /// <param name="parentElement">The parent element.</param>
 /// <param name="by">The by.</param>
 /// <param name="element">The element.</param>
 /// <returns></returns>
 public static ReadOnlyCollection<IWebElement> FindElements(IWebElement parentElement, HtmlElementBy by, string element)
 {
     switch (by)
     {
         case HtmlElementBy.Id:
             return parentElement.FindElements(By.Id(element));
         case HtmlElementBy.XPath:
             return parentElement.FindElements(By.XPath(element));
         case HtmlElementBy.ClassName:
             return parentElement.FindElements(By.ClassName(element));
         case HtmlElementBy.Name:
             return parentElement.FindElements(By.Name(element));
         case HtmlElementBy.CssSelector:
             return parentElement.FindElements(By.CssSelector(element));
         default:
             return null;
     }
 }
コード例 #6
0
ファイル: Utilities.cs プロジェクト: harindu61/twitterTest
 /// <summary>
 /// Finds the element.
 /// </summary>
 /// <param name="driver">The driver.</param>
 /// <param name="by">The by.</param>
 /// <param name="element">The element.</param>
 /// <returns></returns>
 public static IWebElement FindElement(IWebDriver driver, HtmlElementBy by, string element)
 {
     switch (by)
     {
         case HtmlElementBy.Id:
             return driver.FindElement(By.Id(element));
         case HtmlElementBy.XPath:
             return driver.FindElement(By.XPath(element));
         case HtmlElementBy.ClassName:
             return driver.FindElement(By.ClassName(element));
         case HtmlElementBy.Name:
             return driver.FindElement(By.Name(element));
         default:
             return null;
     }
 }
コード例 #7
0
ファイル: Utilities.cs プロジェクト: zaurik/SeShell
        /// <summary>
        /// Finds the elements.
        /// </summary>
        /// <param name="driver">The driver.</param>
        /// <param name="by">The by.</param>
        /// <param name="element">The element.</param>
        /// <returns></returns>
        public static ReadOnlyCollection <IWebElement> FindElements(IWebDriver driver, HtmlElementBy by, string element)
        {
            switch (by)
            {
            case HtmlElementBy.Id:
                return(driver.FindElements(By.Id(element)));

            case HtmlElementBy.XPath:
                return(driver.FindElements(By.XPath(element)));

            case HtmlElementBy.ClassName:
                return(driver.FindElements(By.ClassName(element)));

            case HtmlElementBy.Name:
                return(driver.FindElements(By.Name(element)));

            case HtmlElementBy.CssSelector:
                return(driver.FindElements(By.CssSelector(element)));

            default:
                return(null);
            }
        }