File tree 3 files changed +41
-0
lines changed
ios_tests/lib/ios/specs/ios
3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,13 @@ textfield(value) # Return a XCUIElementTypeSecureTextField or XCUIElementTypeTex
53
53
finds_exact(value) # Return any elements include `value` as its name attributes.
54
54
```
55
55
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
+
56
63
### with XPath
57
64
- It is better to avoid XPath strategy.
58
65
- 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
16
16
# find_elements :predicate, 'wdName == "Buttons"'
17
17
# find_elements :predicate, 'wdValue == "SearchBar" AND isWDDivisible == 1'
18
18
# ```
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
+ # ```
19
32
def extended ( _mod )
20
33
::Appium ::Driver ::SearchContext ::FINDERS [ :uiautomation ] = '-ios uiautomation'
21
34
::Appium ::Driver ::SearchContext ::FINDERS [ :predicate ] = '-ios predicate string'
35
+ ::Appium ::Driver ::SearchContext ::FINDERS [ :class_chain ] = '-ios class chain'
22
36
end
23
37
end # class << self
24
38
end # module Ios
You can’t perform that action at this time.
0 commit comments