コード例 #1
0
ファイル: shaadilogin.cs プロジェクト: TeamIlluminati/G1ANT
        public void Execute(Arguments arguments)
        {
            arguments.Search.Value = "/ hierarchy / android.widget.FrameLayout / android.widget.LinearLayout / android.widget.FrameLayout / android.widget.LinearLayout / android.widget.FrameLayout / android.view.ViewGroup / android.widget.FrameLayout[1] / android.view.ViewGroup / android.widget.Button";
            arguments.By.Value     = "xpath";
            var by = arguments.By.Value.ToLower();

            if (by == "xy")
            {
                TouchAction clickAction = new TouchAction(OpenCommand.GetDriver());
                var         coordinates = arguments.Search.Value.Split(',');
                clickAction.Tap(int.Parse(coordinates[0]), int.Parse(coordinates[1])).Perform();
            }
            else
            {
                ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click();
                arguments.Search.Value = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.view.ViewGroup/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.EditText";
                arguments.By.Value     = "xpath";
                ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click();
                ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).SendKeys(arguments.login.Value);
                arguments.Search.Value = "/ hierarchy / android.widget.FrameLayout / android.widget.LinearLayout / android.widget.FrameLayout / android.widget.LinearLayout / android.widget.FrameLayout / android.widget.RelativeLayout / android.view.ViewGroup / android.widget.ScrollView / android.view.ViewGroup / android.widget.LinearLayout[1] / android.widget.FrameLayout / android.widget.EditText";
                arguments.By.Value     = "xpath";
                ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click();
                ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).SendKeys(arguments.pword.Value);
                arguments.Search.Value = "/ hierarchy / android.widget.FrameLayout / android.widget.LinearLayout / android.widget.FrameLayout / android.widget.LinearLayout / android.widget.FrameLayout / android.widget.RelativeLayout / android.view.ViewGroup / android.widget.ScrollView / android.view.ViewGroup / android.widget.Button";
                arguments.By.Value     = "xpath";
                ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click();
            }
        }
コード例 #2
0
        private static List <AndroidElement> GetElementsByXpath(string xpath)
        {
            var driver = OpenCommand.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.");
            }
        }
コード例 #3
0
        private static List <AndroidElement> GetElementsByText(string text)
        {
            var driver = OpenCommand.GetDriver();
            var wait   = new WebDriverWait(driver, TimeSpan.FromSeconds(7));

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

            try
            {
                wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[contains(@content-desc,\"" + accessibilityId + "\")]")));
                return(new List <AndroidElement>(driver.FindElementsByAccessibilityId(accessibilityId)));
            }
            catch
            {
                throw new ArgumentException($"Element with provided accessibility id was not found.");
            }
        }
コード例 #5
0
ファイル: shaadiback.cs プロジェクト: TeamIlluminati/G1ANT
        public void Execute(Arguments arguments)
        {
            var    driver  = OpenCommand.GetDriver();
            string keycode = arguments.KeyCode.Value.ToLower();

            switch (keycode)
            {
            case "back":
                driver.PressKeyCode(AndroidKeyCode.Back);
                break;

            default:
                throw new ArgumentException($"Provided button name is invalid.");
            }
        }
コード例 #6
0
ファイル: ElementHelper.cs プロジェクト: TeamIlluminati/G1ANT
        private static AndroidElement GetElementByPartialId(string partialId)
        {
            var driver = OpenCommand.GetDriver();
            var wait   = new WebDriverWait(driver, TimeSpan.FromSeconds(7));

            try
            {
                wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[contains(@content-desc,\"" + partialId + "\")]")));
                return(driver.FindElement(By.XPath("//*[contains(@content-desc,\"" + partialId + "\")]")));
            }
            catch
            {
                throw new ArgumentException($"Element with provided partial id was not found.");
            }
        }
コード例 #7
0
ファイル: ElementHelper.cs プロジェクト: TeamIlluminati/G1ANT
        private static AndroidElement GetElementById(string id)
        {
            var driver = OpenCommand.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.");
            }
        }
コード例 #8
0
        public void Execute(Arguments arguments)
        {
            var driver = OpenCommand.GetDriver();

            driver.Quit();
        }