/// <summary> /// This method gets the XPath including the attribute filter. /// </summary> /// <returns>The XPath.</returns> /// <param name="elementType">Element type.</param> /// <param name="attributeFilterType">Attribute type.</param> /// <param name="attributeFilterVal">Attribute name.</param> public static string GetXPath(eGUIElementType elementType, eGUIElementAttribute attributeFilterType, string attributeFilterVal) { string xpath = string.Empty; xpath = GetXPath(elementType) + GetXPathAttributeFilterText(attributeFilterType, attributeFilterVal); Console.WriteLine("xpath = " + xpath); return(xpath); }
/// <summary> /// This method gets the XPath for element. /// </summary> /// <returns>The XPath for element.</returns> /// <param name="elementType">Element type.</param> public static string GetXPath(eGUIElementType elementType) { string xpathForElement = string.Empty; switch (elementType) { case eGUIElementType.Button: xpathForElement = "//XCUIElementTypeButton"; break; case eGUIElementType.NavBarButton: xpathForElement = "//XCUIElementTypeNavigationBar//XCUIElementTypeButton"; break; case eGUIElementType.AlertButton: xpathForElement = "//XCUIElementTypeAlert//XCUIElementTypeButton"; break; case eGUIElementType.AlertTextField: xpathForElement = "//XCUIElementTypeAlert//XCUIElementTypeTextField"; break; case eGUIElementType.AlertSecureTextField: xpathForElement = "//XCUIElementTypeAlert//XCUIElementTypeSecureTextField"; break; case eGUIElementType.AlertText: xpathForElement = "//XCUIElementTypeAlert//XCUIElementTypeStaticText"; break; case eGUIElementType.TableCell: xpathForElement = "//XCUIElementTypeCell//XCUIElementTypeStaticText"; break; case eGUIElementType.ActionSheetButton: xpathForElement = "//XCUIElementTypeSheet//XCUIElementTypeButton"; break; case eGUIElementType.Slider: xpathForElement = "//XCUIElementTypeSlider"; break; case eGUIElementType.StatusBarElement: xpathForElement = "//XCUIElementTypeStatusBar//XCUIElementTypeOther"; break; case eGUIElementType.Switch: xpathForElement = "//XCUIElementTypeSwitch"; break; case eGUIElementType.ProgressIndicator: xpathForElement = "//XCUIElementTypeProgressIndicator"; break; case eGUIElementType.PickerWheel: xpathForElement = "//XCUIElementTypePickerWheel"; break; default: Console.WriteLine("ERROR: Unknown elementType: " + elementType.ToString()); break; } return(xpathForElement); }