public static void InputTextBox(AppiumWebElement dialog, string textBoxId, string inputText) { var textBox = dialog.FindElementByAccessibilityId(textBoxId); textBox.Clear(); textBox.SendKeys(inputText); }
public void FromElementTestCase() { IOSDriver <IWebElement> driver = new IOSDriver <IWebElement>(defaultUri, capabilities); server.respondTo("POST", "/element", new Dictionary <string, object> { { "ELEMENT", '5' } }); AppiumWebElement element = (AppiumWebElement)driver.FindElementByAccessibilityId(".elements()"); server.clear(); server.respondTo("POST", "/element/5/element", new Dictionary <string, object> { { "ELEMENT", '6' } }); element.FindElementByAccessibilityId(".elements()"); server.clear(); List <object> results = new List <object>(); results.Add(new Dictionary <string, object> { { "ELEMENT", "4" } }); server.respondTo("POST", "/element/5/elements", results); element.FindElementsByAccessibilityId(".elements()"); }
public void DismissNotification() { try { AppiumWebElement newNotification = DesktopSession.FindElementByName("New notification"); Assert.IsTrue(newNotification.FindElementByAccessibilityId("MessageText").Text.Contains(NewAlarmName)); newNotification.FindElementByName("Dismiss").Click(); } catch { } }
public static void SetCheckBox(AppiumWebElement dialog, string checkBoxId, bool isToCheck) { var checkBox = dialog.FindElementByAccessibilityId(checkBoxId); if (isToCheck) { if (!checkBox.Selected) { checkBox.Click(); } } else { if (checkBox.Selected) { checkBox.Click(); } } }
/// <summary> /// Delete one of other devices. /// </summary> /// <param name="desktopSession">Desktop session.</param> public void RandomDeleteOneDevice(WindowsDriver <WindowsElement> desktopSession) { var deviceListItems = this.deviceList.FindElementsByClassName("ListBoxItem"); int originalCount = deviceListItems.Count; if (originalCount > 1) { int randomIndex = Utils.RandomSelectIndex(Enumerable.Range(0, deviceListItems.Count), (i) => i != 0); AppiumWebElement randomDevice = deviceListItems[randomIndex]; AppiumWebElement deleteButton = randomDevice.FindElementByAccessibilityId("DeleteButton"); deleteButton.Click(); RemoveDevicePopup removeDevicePopup = new RemoveDevicePopup(desktopSession); Assert.AreEqual("Remove device?", removeDevicePopup.GetTitle()); Assert.IsTrue(removeDevicePopup.GetMessage().StartsWith("Please confirm you would like to remove")); removeDevicePopup.ClickRemoveButton(); int expectedDevices = originalCount - 1; int actualDevices = this.GetTotalNumberOfDevices(originalCount - 1); Assert.AreEqual(expectedDevices, actualDevices); } }