docs/ios_xcuitest.md in appium_lib-9.3.3 vs docs/ios_xcuitest.md in appium_lib-9.3.4

- old
+ new

@@ -11,11 +11,11 @@ - [locatorStrategies](https://github.com/appium/appium-xcuitest-driver/blob/95886f1118d71fe950768f8262179d3608b40fc7/lib/driver.js#L81) - [WebDriverAgent](https://github.com/facebook/WebDriverAgent/blob/8346199212bffceab24192e81bc0118d65132466/WebDriverAgentLib/Commands/FBFindElementCommands.m#L111) - Mapping - https://github.com/facebook/WebDriverAgent/blob/master/WebDriverAgentLib/Utilities/FBElementTypeTransformer.m#L19 -### with except for XPath +### with except for XPath and Predicate #### examples - [button_class](https://github.com/appium/ruby_lib/blob/master/lib/appium_lib/ios/element/button.rb#L8), [static_text_class](https://github.com/appium/ruby_lib/blob/master/lib/appium_lib/ios/element/text.rb#L8), [text_field_class](https://github.com/appium/ruby_lib/blob/master/lib/appium_lib/ios/element/textfield.rb#L10) and [secure_text_field_class](https://github.com/appium/ruby_lib/blob/master/lib/appium_lib/ios/element/textfield.rb#L15) provide class name. - If `automationName` is `Appium` or `nil`, then they provide `UIAxxxx` - If `automationName` is `XCUITest`, then they provide `XCUIElementTypexxx` @@ -34,11 +34,27 @@ - `button/s(value)`, `button_exact/buttons_exact`, `text/s(value)`, `text_exact/texts_exact` ```ruby buttons(value) # Return button elements include `value` as its name attributes. ``` +### with Predicate +- We recommend to use predicate strategy instead of XPath strategy. + - e.g. `find_ele_by_predicate/find_eles_by_predicate`, `find_ele_by_predicate_include/find_eles_by_predicate_include` +- A helpful cheatsheet for predicate + - https://realm.io/news/nspredicate-cheatsheet/ +- For XCUITest(WebDriverAgent), without 'wd' prefixes are supported. + - https://github.com/facebook/WebDriverAgent/wiki/Queries + - For example, `%(name ==[c] "#{value}" || label ==[c] "#{value}" || value ==[c] "#{value}")` is equal to `%(wdName ==[c] "#{value}" || wdLabel ==[c] "#{value}" || wdValue ==[c] "#{value}")` in WebDriverAgent. +#### examples +- `textfield/s(value)`, `find/s`, `find_exact/finds_exact`, `find_ele_by_predicate/find_eles_by_predicate` and `find_ele_by_predicate_include/find_eles_by_predicate_include` use predicate strategy in their method. + +```ruby +textfield(value) # Return a XCUIElementTypeSecureTextField or XCUIElementTypeTextField element which has `value` text. +finds_exact(value) # Return any elements include `value` as its name attributes. +``` + ### with XPath - It is better to avoid XPath strategy. - https://github.com/appium/appium/blob/v1.6.2/docs/en/advanced-concepts/migrating-to-xcuitest.md#xpath-locator-strategy - > Try not to use XPath locators unless there are absolutely no other alternatives. In general, XPath locators might be times slower, than other types of locators like accessibility id, class name and predicate (up to 100 times slower in some special cases). They are so slow because XPath location is not natively supported by Apple's XCTest framework. - Improved performance a bit @@ -46,14 +62,12 @@ - https://github.com/facebook/WebDriverAgent/issues/306 - XPath in WebDriverAgent - https://github.com/facebook/WebDriverAgent/blob/2158a8d0f305549532f1338fe1e4628cfbd53cd9/WebDriverAgentLib/Categories/XCElementSnapshot%2BFBHelpers.m#L57 #### examples -- `textfield/s(value)`, `find/s`, `find_exact/finds_exact` uses XPath in their method. So, these methods are slower than other find_element directly. ```ruby -textfield(value) # Return a XCUIElementTypeSecureTextField or XCUIElementTypeTextField element which has `value` text. -finds_exact(value) # Return any elements include `value` as its name attributes. +xpaths("//some xpaths") ``` ## Other actions Basically, other actions such as `type` are compatible with `automationName = Appium`.