public void TestShouldFindElementsByPredicate() { // need newer version to use FindElementsByNSPredicate ICollection <IOSElement> elements = driver.FindElements("-ios predicate string", "visible = 1"); Assert.AreEqual(27, elements.Count); }
public void FindByAccessibilityIdTest() { By byAccessibilityId = new ByAccessibilityId("ComputeSumButton"); Assert.AreNotEqual(driver.FindElement(byAccessibilityId).Text, null); Assert.GreaterOrEqual(driver.FindElements(byAccessibilityId).Count, 1); }
/// <summary> /// This method returns displayed elements filtered by selector criteria /// </summary> /// <param name="appDriver">Application driver</param> /// <param name="selector">selector for filtering</param> /// <returns></returns> public static ReadOnlyCollection <IOSElement> FindDisplayedElements(IOSDriver <IOSElement> appDriver, By selector) { ReadOnlyCollection <IOSElement> roDisplayedElements = null; ReadOnlyCollection <IOSElement> filteredElementsByFindElements; List <IOSElement> displayedElements = new List <IOSElement>(); try { //filteredElementsByFindElements contains all elements filtered by selector filteredElementsByFindElements = appDriver.FindElements(selector); //From filteredElementsByFindElements, only move the Displayed elements to displayedElements foreach (IOSElement element in filteredElementsByFindElements) { if (element.Displayed) { displayedElements.Add(element); } } //Create a ReadOnlyCollection<T> from displayedElements roDisplayedElements = new ReadOnlyCollection <IOSElement>(displayedElements); } catch (NotFoundException) { Console.WriteLine("0 elements found"); } catch (Exception e) { Console.WriteLine("ERROR: \n StackTrace:\n" + e.StackTrace + "\n Error Message:\n" + e.Message); } return(roDisplayedElements); }
public void FindByClassChainTest() { var sliderCellStaticTextElements1 = _driver .FindElements( new ByIosClassChain("**/XCUIElementTypeCell/XCUIElementTypeStaticText[`name == 'Sliders'`]")); Assert.AreEqual(sliderCellStaticTextElements1.Count, 1); var sliderCellStaticTextElements2 = _driver .FindElementsByIosClassChain("**/XCUIElementTypeCell"); Assert.AreEqual(sliderCellStaticTextElements2.Count, 18); }
public void FindByClassChainTest() { ReadOnlyCollection <AppiumWebElement> sliderCellStaticTextElements_1 = driver .FindElements( new ByIosClassChain("**/XCUIElementTypeCell/XCUIElementTypeStaticText[`name == 'Sliders'`]")); Assert.AreEqual(sliderCellStaticTextElements_1.Count, 1); ReadOnlyCollection <AppiumWebElement> sliderCellStaticTextElements_2 = driver .FindElementsByIosClassChain("**/XCUIElementTypeCell"); Assert.AreEqual(sliderCellStaticTextElements_2.Count, 18); }
public void FindByClassChainTest() { ReadOnlyCollection <AppiumWebElement> sliderCellStaticTextElements_1 = driver .FindElements(new ByIosClassChain("**/XCUIElementTypeCell/XCUIElementTypeStaticText[`name == 'Sliders'`]")); Assert.AreEqual(sliderCellStaticTextElements_1.Count, 1); ReadOnlyCollection <AppiumWebElement> sliderCellStaticTextElements_2 = driver .FindElementsByIosClassChain("**/XCUIElementTypeCell"); Assert.AreEqual(sliderCellStaticTextElements_2.Count, 18); AppiumWebElement actionSheetsCell = driver.FindElement(new ByIosClassChain("**/XCUIElementTypeCell/XCUIElementTypeStaticText[`name == 'Action Sheets'`]")); actionSheetsCell.Tap(1, 250); driver.FindElementByIosClassChain("**/XCUIElementTypeNavigationBar/XCUIElementTypeButton").Click(); }
public void ByIosUIAutomationTestCase() { IOSDriver driver = new IOSDriver(defaultUri, capabilities); server.respondTo("POST", "/element", new Dictionary <string, object> { { "ELEMENT", '5' } }); driver.FindElement(new ByIosUIAutomation(".elements()")); (new ByIosUIAutomation(".elements()")).FindElement(driver); server.clear(); List <object> results = new List <object>(); results.Add(new Dictionary <string, object> { { "ELEMENT", "4" } }); server.respondTo("POST", "/elements", results); driver.FindElements(new ByIosUIAutomation(".elements()")); (new ByIosUIAutomation(".elements()")).FindElements(driver); }
public void ByAccessibilityIdTestCase() { IOSDriver <IWebElement> driver = new IOSDriver <IWebElement>(defaultUri, capabilities); server.respondTo("POST", "/element", new Dictionary <string, object> { { "ELEMENT", '5' } }); driver.FindElement(new ByAccessibilityId(".elements()")); (new ByAccessibilityId(".elements()")).FindElement(driver); server.clear(); List <object> results = new List <object>(); results.Add(new Dictionary <string, object> { { "ELEMENT", "4" } }); server.respondTo("POST", "/elements", results); driver.FindElements(new ByAccessibilityId(".elements()")); (new ByAccessibilityId(".elements()")).FindElements(driver); }