public void CSharpIOSNativeTest1() { try { WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30)); reportiumClient.StepStart("Enter email"); IOSElement email = (IOSElement)wait.Until(ExpectedConditions.ElementIsVisible((By.Name("login_email")))); email.SendKeys("*****@*****.**"); reportiumClient.StepStart("Enter password"); IOSElement password = (IOSElement)wait.Until(ExpectedConditions.ElementIsVisible((By.Name("login_password")))); password.SendKeys("test123"); driver.HideKeyboard(); reportiumClient.StepStart("Click login"); driver.HideKeyboard(); IOSElement login = (IOSElement)wait.Until(ExpectedConditions.ElementIsVisible((By.Name("login_login_btn")))); login.Click(); reportiumClient.StepStart("Add expense"); IOSElement add = (IOSElement)wait.Until(ExpectedConditions.ElementIsVisible((By.Name("list_add_btn")))); add.Click(); reportiumClient.StepStart("Select head"); IOSElement head = (IOSElement)wait.Until(ExpectedConditions.ElementIsVisible((By.Name("edit_head")))); head.Click(); wait.Until(ExpectedConditions.PresenceOfAllElementsLocatedBy(By.XPath("//*[@value='- Select -']")))[0].SendKeys("Flight"); reportiumClient.StepStart("Enter amount"); IOSElement amount = (IOSElement)wait.Until(ExpectedConditions.ElementIsVisible((By.Name("edit_amount")))); amount.SendKeys("100"); reportiumClient.StepStart("Save expense"); IOSElement save = (IOSElement)wait.Until(ExpectedConditions.ElementIsVisible((By.Name("add_save_btn")))); save.Click(); reportiumClient.StepStart("Verify alert"); String expectedText = "Please enter valid category"; Boolean res = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[@name='" + expectedText + "']"))).Displayed; reportiumClient.ReportiumAssert("Alert text validation.", res); reportiumClient.TestStop(Reportium.Test.Result.TestResultFactory.CreateSuccess()); } catch (Exception e) { reportiumClient.TestStop(Reportium.Test.Result.TestResultFactory.CreateFailure(e)); } ////Close connection and ends the test driver.Quit(); Console.WriteLine("C# IOS execution completed"); }
public void HideKeyboardTestCase() { IOSDriver <IWebElement> driver = new IOSDriver <IWebElement>(defaultUri, capabilities); { server.clear(); RequestProcessor re = server.respondTo("POST", "/appium/device/hide_keyboard", null); driver.HideKeyboard(key: "Done"); Assert.AreEqual(re.inputData, "{\"keyName\":\"Done\"}"); } { server.clear(); RequestProcessor re = server.respondTo("POST", "/appium/device/hide_keyboard", null); driver.HideKeyboard("pressKey", "Done"); Assert.AreEqual(re.inputData, "{\"strategy\":\"pressKey\",\"keyName\":\"Done\"}"); } { server.clear(); RequestProcessor re = server.respondTo("POST", "/appium/device/hide_keyboard", null); driver.HideKeyboard("tapOutside"); Assert.AreEqual(re.inputData, "{\"strategy\":\"tapOutside\"}"); } }
public void RunElementAction() { // Create Action var action = new TypeRandomPhoneAction(); // Prepare state driver.FindElement(By.Id("name")).SendKeys("John Smith"); driver.FindElement(By.Id("password")).SendKeys("12345"); driver.FindElement(By.Id("login")).Click(); driver.HideKeyboard(); // Set action parameters action.countryCode = "1"; action.maxDigits = 8; // Run action runner.Run(action, By.Id("phone")); }
public void HideKeyboard() { driver.HideKeyboard(); }