Skip to content

Commit b5414b7

Browse files
Update documentation for appium 1.0
1 parent de25322 commit b5414b7

File tree

13 files changed

+233
-94
lines changed

13 files changed

+233
-94
lines changed

lib/appium_lib/android/element/alert.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Appium
22
module Android
3-
# Tap the alert button identified by value.
3+
# Click the first alert button that contains value or by index.
44
# @param value [Integer, String] either an integer index of the button or the button's name
55
# @return [void]
66
def alert_click value

lib/appium_lib/android/element/button.rb

+12-8
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ def _button_contains_string value
3232

3333
public
3434

35-
# Find a button by text and optionally number.
36-
# @param value [String, Integer] the value to exactly match. If int then the button at that index is returned.
37-
# @return [Button] the button found with text and matching number
35+
# Find the first button that contains value or by index.
36+
# @param value [String, Integer] the value to exactly match.
37+
# If int then the button at that index is returned.
38+
# @return [Button]
3839
def button value
3940
# Don't use ele_index because that only works on one element type.
4041
# Android needs to combine button and image button to match iOS.
@@ -48,37 +49,40 @@ def button value
4849
xpath _button_contains_string value
4950
end
5051

52+
# Find all buttons containing value
53+
# @param value [String] the value to search for
54+
# @return [Array<Button>]
5155
def buttons value
5256
xpaths _button_contains_string value
5357
end
5458

55-
# Get the first button element.
59+
# Find the first button.
5660
# @return [Button]
5761
def first_button
5862
xpath _button_visible_string
5963
end
6064

61-
# Get the last button element.
65+
# Find the last button.
6266
# @return [Button]
6367
def last_button
6468
xpath _button_visible_string index: 'last()'
6569
end
6670

67-
# Get the first button element that exactly matches text.
71+
# Find the first button that exactly matches value.
6872
# @param value [String] the value to match exactly
6973
# @return [Button]
7074
def button_exact value
7175
xpath _button_exact_string value
7276
end
7377

74-
# Get all button elements that exactly match text.
78+
# Find all buttons that exactly match value.
7579
# @param value [String] the value to match exactly
7680
# @return [Array<Button>]
7781
def buttons_exact value
7882
xpaths _button_exact_string value
7983
end
8084

81-
# Get an array of button elements.
85+
# Find all buttons.
8286
# @return [Array<Button>]
8387
def e_buttons
8488
xpaths _button_visible_string

lib/appium_lib/android/element/generic.rb

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,35 @@
11
module Appium
22
module Android
33

4+
# Find the first element containing value
5+
# @param value [String] the value to search for
6+
# @return [Element]
47
def find value
58
xpath_visible_contains '*', value
69
end
710

11+
# Find all elements containing value
12+
# @param value [String] the value to search for
13+
# @return [Array<Element>]
814
def finds value
915
xpaths_visible_contains '*', value
1016
end
1117

18+
# Find the first element exactly matching value
19+
# @param value [String] the value to search for
20+
# @return [Element]
1221
def find_exact value
1322
xpath_visible_exact '*', value
1423
end
1524

25+
# Find all elements exactly matching value
26+
# @param value [String] the value to search for
27+
# @return [Array<Element>]
1628
def finds_exact value
1729
xpaths_visible_exact '*', value
1830
end
1931

20-
# Scroll to an element containing target text or description.
32+
# Scroll to the first element containing target text or description.
2133
# @param text [String] the text to search for in the text value and content description
2234
# @return [Element] the element scrolled to
2335
def scroll_to text
@@ -30,7 +42,7 @@ def scroll_to text
3042
complex_find mode: 'scroll', selectors: args
3143
end
3244

33-
# Scroll to an element with the exact target text or description.
45+
# Scroll to the first element with the exact target text or description.
3446
# @param text [String] the text to search for in the text value and content description
3547
# @return [Element] the element scrolled to
3648
def scroll_to_exact text

lib/appium_lib/android/element/text.rb

+19-15
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,50 @@ module Appium
33
module Android
44
TextView = 'android.widget.TextView'
55

6-
# Get the first element that includes text.
7-
# @param value [String, Integer] the value to find. If int then the text at that index is returned.
8-
# @return [Text]
6+
# Find the first TextView that contains value or by index.
7+
# @param value [String, Integer] the value to find.
8+
# If int then the TextView at that index is returned.
9+
# @return [TextView]
910
def s_text value
1011
return ele_index TextView, value if value.is_a? Numeric
1112
xpath_visible_contains TextView, value
1213
end
1314

15+
# Find all TextViews containing value.
16+
# @param value [String] the value to search for
17+
# @return [Array<TextView>]
1418
def s_texts value
1519
xpaths_visible_contains TextView, value
1620
end
1721

18-
# Get the first text element.
19-
# @return [Text]
22+
# Find the first TextView.
23+
# @return [TextView]
2024
def first_s_text
2125
first_ele TextView
2226
end
2327

24-
# Get the last text element
25-
# @return [Text]
28+
# Find the last TextView.
29+
# @return [TextView]
2630
def last_s_text
2731
last_ele TextView
2832
end
2933

30-
# Get the first textfield that matches text.
31-
# @param value [String] the value that the tag must match
32-
# @return [Text]
34+
# Find the first TextView that exactly matches value.
35+
# @param value [String] the value to match exactly
36+
# @return [TextView]
3337
def s_text_exact value
3438
xpath_visible_exact TextView, value
3539
end
3640

37-
# Get all static textfields that matches text.
38-
# @param value [String] the value that the tag must match
39-
# @return [Array<Text>]
41+
# Find all TextViews that exactly match value.
42+
# @param value [String] the value to match exactly
43+
# @return [Array<TextView>]
4044
def s_texts_exact value
4145
xpaths_visible_exact TextView, value
4246
end
4347

44-
# Get an array of text elements.
45-
# @return [Array<Text>]
48+
# Find all TextViews.
49+
# @return [Array<TextView>]
4650
def e_s_texts
4751
tags TextView
4852
end

lib/appium_lib/android/element/textfield.rb

+19-12
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,50 @@ module Appium
22
module Android
33
EditText = 'android.widget.EditText'
44

5-
# Get the first textfield that matches text.
6-
# @param value [String, Integer] the text to match exactly. If int then the textfield at that index is returned.
7-
# @return [Textfield]
5+
# Find the first EditText that contains value or by index.
6+
# @param value [String, Integer] the text to match exactly.
7+
# If int then the EditText at that index is returned.
8+
# @return [EditText]
89
def textfield value
910
return ele_index EditText, value if value.is_a? Numeric
1011
xpath_visible_contains EditText, value
1112
end
1213

14+
# Find all EditTexts containing value.
15+
# @param value [String] the value to search for
16+
# @return [Array<EditText>]
1317
def textfields value
1418
xpaths_visible_contains EditText, value
1519
end
1620

17-
# Get the first textfield element.
18-
# @return [Textfield]
21+
# Find the first EditText.
22+
# @return [EditText]
1923
def first_textfield
2024
first_ele EditText
2125
end
2226

23-
# Get the last textfield element.
24-
# @return [Textfield]
27+
# Find the last EditText.
28+
# @return [EditText]
2529
def last_textfield
2630
last_ele EditText
2731
end
2832

29-
# Get the first textfield that exactly matches text.
30-
# @param value [String] the value the textfield must exactly match
31-
# @return [Textfield]
33+
# Find the first EditText that exactly matches value.
34+
# @param value [String] the value to match exactly
35+
# @return [EditText]
3236
def textfield_exact value
3337
xpath_visible_exact EditText, value
3438
end
3539

40+
# Find all EditTexts that exactly match value.
41+
# @param value [String] the value to match exactly
42+
# @return [Array<EditText>]
3643
def textfields_exact value
3744
xpaths_visible_exact EditText, value
3845
end
3946

40-
# Get an array of textfield elements.
41-
# @return [Array<Textfield>]
47+
# Find all EditTexts.
48+
# @return [Array<EditText>]
4249
def e_textfields
4350
tags EditText
4451
end

0 commit comments

Comments
 (0)