Skip to content

Commit 684aa0d

Browse files
Merge pull request #168 from DylanLacey/master
Use new complex_find method.
2 parents 7475d38 + 6875a48 commit 684aa0d

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

android_tests/lib/android/specs/common/device.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
end
6363

6464
t 'complex_find' do
65-
act = complex_find [[3, 'Accessibility'], [14, true]]
65+
act = complex_find [[[3, 'Accessibility'], [14, true]]]
6666
act.class.must_equal Selenium::WebDriver::Element
6767
end
6868

lib/appium_lib/android/element/generic.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,26 @@ def finds_exact value
2121
# @param text [String] the text to search for in the text value and content description
2222
# @return [Element] the element scrolled to
2323
def scroll_to text
24-
args = 'scroll',
24+
args =
2525
# textContains(text)
2626
[[3, text]],
2727
# descriptionContains(text)
2828
[[7, text]]
2929

30-
complex_find args
30+
complex_find 'scroll', args
3131
end
3232

3333
# Scroll to an element with the exact target text or description.
3434
# @param text [String] the text to search for in the text value and content description
3535
# @return [Element] the element scrolled to
3636
def scroll_to_exact text
37-
args = 'scroll',
37+
args =
3838
# text(text)
3939
[[1, text]],
4040
# description(text)
4141
[[5, text]]
4242

43-
complex_find args
43+
complex_find 'scroll', args
4444
end
4545
end # module Android
4646
end # module Appium

lib/appium_lib/device/device.rb

+9-9
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ module Device
4747
# of arrays, each containing a selector and that selector's value.
4848
#
4949
# ```ruby
50-
# complex_find [[2, 'Sau'], [14, true]] # => Find a clickable element
51-
# # whose names starts with 'Sau'
50+
# complex_find [[[2, 'Sau'], [14, true]]] # => Find a clickable element
51+
# # whose names starts with 'Sau'
5252
# ```
53-
# @param all (Symbol) If not falsy, will use the 'all' option in your find
53+
# @param mod (Symbol) If present, will be the 0th element in the selector array.
5454
# @param selectors (Array<Object>) The selectors to find elements with.
5555

5656
# @!method hide_keyboard
@@ -140,17 +140,17 @@ def key_event(key, metastate=nil)
140140
end
141141

142142
add_endpoint_method(:complex_find, 'session/:session_id/appium/app/complex_find') do
143-
def complex_find(all, selectors=nil)
143+
def complex_find(mode, selectors=nil)
144144
if selectors.nil?
145-
selectors = all.dup
146-
all = false
145+
selectors = mod.dup
146+
mod = false
147147
end
148148

149-
selector_array = all ? ['all'] : []
149+
selector_array = mod ? [mod] : []
150150
selector_array.push selectors
151151

152-
ids = execute :complex_find, {}, [selectors]
153-
if all && ids.length > 1
152+
ids = execute :complex_find, {}, selectors
153+
if mod && ids.length > 1
154154

155155
return ids.map { |id| Selenium::WebDriver::Element.new self, element_id_from(id) }
156156
else

lib/appium_lib/ios/helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module Appium
1+
module Appium
22
module Ios
33
# iOS only. On Android uiautomator always returns an empty string for EditText password.
44
#

0 commit comments

Comments
 (0)