public static void ClickOnElement(AndroidDriver <AppiumWebElement> webDriver, string by, string elementName, int timeInseconds) { switch (by) { case "id": webDriver.FindElementById(elementName).Click(); break; case "xPath": webDriver.FindElementByXPath(elementName).Click(); break; case "cssSelector": webDriver.FindElementByCssSelector(elementName).Click(); break; case "name": webDriver.FindElementByName(elementName).Click(); break; case "className": webDriver.FindElementByClassName(elementName).Click(); break; case "linkText": webDriver.FindElementByLinkText(elementName).Click(); break; } Thread.Sleep(timeInseconds * 1000); }
public static string GetValueFromElement(AndroidDriver <AppiumWebElement> webDriver, string by, string elementName, int timeInseconds) { string elementText = ""; switch (by) { case "id": elementText = webDriver.FindElementById(elementName).GetAttribute("value"); break; case "xPath": elementText = webDriver.FindElementByXPath(elementName).GetAttribute("value"); break; case "cssSelector": elementText = webDriver.FindElementByCssSelector(elementName).GetAttribute("value"); break; case "name": elementText = webDriver.FindElementByName(elementName).GetAttribute("value"); break; case "className": elementText = webDriver.FindElementByClassName(elementName).GetAttribute("value"); break; case "linkText": elementText = webDriver.FindElementByLinkText(elementName).GetAttribute("value"); break; } Thread.Sleep(timeInseconds * 1000); return(elementText); }