// Implement this method public void Execute(Arguments arguments) { arguments.Search.Value = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.support.v4.widget.DrawerLayout/android.widget.RelativeLayout/android.widget.RelativeLayout[2]/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.ViewAnimator/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.EditText"; arguments.By.Value = "xpath"; ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).Click(); arguments.Search.Value = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.support.v4.widget.DrawerLayout/android.widget.RelativeLayout/android.widget.RelativeLayout[2]/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.ViewAnimator/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.EditText"; arguments.By.Value = "xpath"; ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).SendKeys(arguments.product.Value); var driver = AmazonAndroidOpenCommand.GetDriver(); driver.PressKeyCode(keyCode: 66, metastate: -1); }
private static AndroidElement GetElementByXpath(string xpath) { var driver = AmazonAndroidOpenCommand.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."); } }
private static AndroidElement GetElementByText(string text) { var driver = AmazonAndroidOpenCommand.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."); } }
private static AndroidElement GetElementByAccessibilityId(string accessibilityId) { var driver = AmazonAndroidOpenCommand.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."); } }
private static List <AndroidElement> GetElementsByPartialId(string partialId) { var driver = AmazonAndroidOpenCommand.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."); } }
private static List <AndroidElement> GetElementsById(string id) { var driver = AmazonAndroidOpenCommand.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."); } }
public void Execute(Arguments arguments) { var driver = AmazonAndroidOpenCommand.GetDriver(); driver.Quit(); }