コード例 #1
0
        private static List <AndroidElement> GetElementsByXpath(string xpath)
        {
            var driver = LineAndroidOpenCommand.GetDriver();
            var wait   = new WebDriverWait(driver, TimeSpan.FromSeconds(7));

            try
            {
                wait.Until(ExpectedConditions.ElementIsVisible(By.XPath(xpath)));
                return(new List <AndroidElement>(driver.FindElements(By.XPath(xpath))));
            }
            catch
            {
                throw new ArgumentException($"Element with provided xpath was not found.");
            }
        }
コード例 #2
0
        private static List <AndroidElement> GetElementsByPartialId(string partialId)
        {
            var driver = LineAndroidOpenCommand.GetDriver();
            var wait   = new WebDriverWait(driver, TimeSpan.FromSeconds(7));

            try
            {
                wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[contains(@content-desc,\"" + partialId + "\")]")));
                return(new List <AndroidElement>(driver.FindElements(By.XPath("//*[contains(@content-desc,\"" + partialId + "\")]"))));
            }
            catch
            {
                throw new ArgumentException($"Element with provided partial id was not found.");
            }
        }
コード例 #3
0
        private static AndroidElement GetElementByText(string text)
        {
            var driver = LineAndroidOpenCommand.GetDriver();
            var wait   = new WebDriverWait(driver, TimeSpan.FromSeconds(7));

            try
            {
                wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[contains(text(),\"" + text + "\")]")));
                return(driver.FindElement(By.XPath("//*[contains(text(),\"" + text + "\")]")));
            }
            catch
            {
                throw new ArgumentException($"Element with provided text was not found.");
            }
        }
コード例 #4
0
        private static AndroidElement GetElementByAccessibilityId(string accessibilityId)
        {
            var driver = LineAndroidOpenCommand.GetDriver();
            var wait   = new WebDriverWait(driver, TimeSpan.FromSeconds(7));

            try
            {
                wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[contains(@content-desc,\"" + accessibilityId + "\")]")));
                return(driver.FindElementByAccessibilityId(accessibilityId));
            }
            catch
            {
                throw new ArgumentException($"Element with provided accessibility id was not found.");
            }
        }
コード例 #5
0
        private static AndroidElement GetElementById(string id)
        {
            var driver = LineAndroidOpenCommand.GetDriver();
            var wait   = new WebDriverWait(driver, TimeSpan.FromSeconds(7));

            try
            {
                wait.Until(ExpectedConditions.ElementIsVisible(By.Id(id)));
                return(driver.FindElementById(id));
            }
            catch
            {
                throw new ArgumentException($"Element with provided id was not found.");
            }
        }
コード例 #6
0
        public void Execute(Arguments arguments)
        {
            var driver = LineAndroidOpenCommand.GetDriver();

            driver.Quit();
        }