Esempio n. 1
0
        public void Execute(Arguments arguments)
        {
            arguments.Search.Value = "com.snapchat.android:id / login_button_horizontal";
            arguments.By.Value     = "id";
            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.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout[1]/android.widget.ScrollView/android.widget.LinearLayout/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.email.Value);
                arguments.Search.Value = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout[1]/android.widget.ScrollView/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.pword.Value);
                arguments.Search.Value = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout[2]/android.widget.LinearLayout/android.widget.TextView";
                arguments.By.Value     = "xpath";
                ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click();
            }
        }
        public void Execute(Arguments arguments)
        {
            arguments.Search.Value = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[3]/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout[1]";
            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.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.FrameLayout[2]/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout[2]/android.widget.TextView";
                arguments.By.Value = "xpath";
                ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click();
                ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).SendKeys(arguments.search.Value);
                arguments.Search.Value = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup[4]/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup/android.view.ViewGroup";
                arguments.By.Value = "xpath";
                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.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[1]/android.widget.RelativeLayout/android.widget.LinearLayout[2]/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.search.Value);
               

            }
        }
Esempio n. 3
0
        private static AndroidElement GetElementByXpath(string xpath)
        {
            var driver = OpenCommand.GetDriver();
            var wait   = new WebDriverWait(driver, TimeSpan.FromSeconds(7));

            try
            {
                wait.Until(ExpectedConditions.ElementIsVisible(By.XPath(xpath)));
                return(driver.FindElement(By.XPath(xpath)));
            }
            catch
            {
                throw new ArgumentException($"Element with provided xpath was not found.");
            }
        }
Esempio n. 4
0
        private static AndroidElement GetElementByText(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(driver.FindElement(By.XPath("//*[contains(text(),\"" + text + "\")]")));
            }
            catch
            {
                throw new ArgumentException($"Element with provided text was not found.");
            }
        }
Esempio n. 5
0
        private static AndroidElement GetElementByAccessibilityId(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(driver.FindElementByAccessibilityId(accessibilityId));
            }
            catch
            {
                throw new ArgumentException($"Element with provided accessibility id was not found.");
            }
        }
Esempio n. 6
0
        private static List <AndroidElement> GetElementsByPartialId(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(new List <AndroidElement>(driver.FindElements(By.XPath("//*[contains(@content-desc,\"" + partialId + "\")]"))));
            }
            catch
            {
                throw new ArgumentException($"Element with provided partial id was not found.");
            }
        }
Esempio n. 7
0
        private static List <AndroidElement> GetElementsById(string id)
        {
            var driver = OpenCommand.GetDriver();
            var wait   = new WebDriverWait(driver, TimeSpan.FromSeconds(7));

            try
            {
                wait.Until(ExpectedConditions.ElementIsVisible(By.Id(id)));
                return(new List <AndroidElement>(driver.FindElementsById(id)));
            }
            catch
            {
                throw new ArgumentException($"Element with provided id was not found.");
            }
        }
Esempio n. 8
0
        public void Execute(Arguments arguments)
        {
            arguments.Search.Value = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[3]/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout[3]";;
            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();
            }
        }
Esempio n. 9
0
        public void Execute(Arguments arguments)
        {
            arguments.Search.Value = "com.snapchat.android:id/avatar_silhouette_3";
            arguments.By.Value     = "id";
            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 = "com.snapchat.android:id/camera_flip_button";
                arguments.By.Value     = "id";
                ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click();
            }
        }