public void Execute(Arguments arguments) { 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(by, arguments.Search.Value).Click(); } }
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."); } }
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."); } }
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."); } }
public void Execute(Arguments arguments) { 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(by, arguments.Search.Value).Click(); } Thread.Sleep(3000); 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/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.widget.FrameLayout[2]/android.widget.FrameLayout/android.view.ViewGroup[2]/android.support.v7.widget.RecyclerView/android.widget.LinearLayout[1]"; arguments.By.Value = "xpath"; ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).Click(); }
public void Execute(Arguments arguments) { 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(by, arguments.Search.Value).Click(); } arguments.Search.Value = "com.google.android.youtube:id/search_edit_text"; arguments.By.Value = "Id"; ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).SendKeys(arguments.keyword.Value); RobotMessageBox.Show(arguments.message.Value); }
public void Execute(Arguments arguments) { var driver = OpenCommand.GetDriver(); driver.Quit(); }