File tree Expand file tree Collapse file tree
ios_tests/lib/ios/specs/ios Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,6 +53,13 @@ textfield(value) # Return a XCUIElementTypeSecureTextField or XCUIElementTypeTex
5353finds_exact(value) # Return any elements include `value` as its name attributes.
5454```
5555
56+ ### with Class Chain
57+ - require Appium 1.6.4+
58+ - https://github.com/appium/appium-xcuitest-driver/pull/391
59+ - https://github.com/appium/java-client/pull/599/files
60+ - WebDriverAgent
61+ - https://github.com/facebook/WebDriverAgent/wiki/Queries
62+
5663### with XPath
5764- It is better to avoid XPath strategy.
5865 - https://github.com/appium/appium/blob/v1.6.2/docs/en/advanced-concepts/migrating-to-xcuitest.md#xpath-locator-strategy
Original file line number Diff line number Diff line change 1+ # rake ios[ios/mobile_methods]
2+ describe 'ios/mobile_methods' do
3+ def before_first
4+ screen . must_equal catalog
5+ end
6+
7+ t 'an element with class chain' do
8+ element = find_element :class_chain , 'XCUIElementTypeWindow/*/*/XCUIElementTypeStaticText'
9+
10+ element . name . must_equal catalog
11+ end
12+
13+ t 'elements with class chain' do
14+ elements = find_elements :class_chain , 'XCUIElementTypeWindow/*/*'
15+
16+ elements . size . must_equal 2
17+ elements [ 0 ] . name . must_equal catalog
18+ elements [ 1 ] . name . must_be_nil
19+ end
20+ end
Original file line number Diff line number Diff line change @@ -16,9 +16,23 @@ class << self
1616 # find_elements :predicate, 'wdName == "Buttons"'
1717 # find_elements :predicate, 'wdValue == "SearchBar" AND isWDDivisible == 1'
1818 # ```
19+ #
20+ # @!method ios_class_chain_find
21+ # Only for XCUITest(WebDriverAgent)
22+ # find_element/s can be used with a [class chain]( https://github.com/facebook/WebDriverAgent/wiki/Queries)
23+ #
24+ # ```ruby
25+ # # select the third child button of the first child window element
26+ # find_elements :class_chain, 'XCUIElementTypeWindow/XCUIElementTypeButton[3]'
27+ # # select all the children windows
28+ # find_elements :class_chain, 'XCUIElementTypeWindow'
29+ # # select the second last child of the second child window
30+ # find_elements :class_chain, 'XCUIElementTypeWindow[2]/XCUIElementTypeAny[-2]'
31+ # ```
1932 def extended ( _mod )
2033 ::Appium ::Driver ::SearchContext ::FINDERS [ :uiautomation ] = '-ios uiautomation'
2134 ::Appium ::Driver ::SearchContext ::FINDERS [ :predicate ] = '-ios predicate string'
35+ ::Appium ::Driver ::SearchContext ::FINDERS [ :class_chain ] = '-ios class chain'
2236 end
2337 end # class << self
2438 end # module Ios
You can’t perform that action at this time.
0 commit comments