appium_lib 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +12 -1
- data/docs/android_docs.md +172 -164
- data/docs/ios_docs.md +174 -118
- data/lib/appium_lib/android/helper.rb +10 -0
- data/lib/appium_lib/common/helper.rb +6 -7
- data/lib/appium_lib/common/version.rb +2 -2
- data/lib/appium_lib/ios/element/textfield.rb +13 -8
- data/lib/appium_lib/ios/helper.rb +9 -0
- data/release_notes.md +9 -0
- metadata +2 -2
@@ -424,4 +424,14 @@ module Appium::Android
|
|
424
424
|
activity: act,
|
425
425
|
am_start: pkg + '/' + act
|
426
426
|
end
|
427
|
+
|
428
|
+
# Find by id. Useful for selendroid
|
429
|
+
# @param id [String] the id to search for
|
430
|
+
# @return [Element]
|
431
|
+
def id id
|
432
|
+
lazy_load_strings
|
433
|
+
# resource ids must include ':' and they're not contained in strings_xml
|
434
|
+
raise "Invalid id `#{id}`" unless @strings_xml[id] || id.include?(':')
|
435
|
+
find_element :id, id
|
436
|
+
end
|
427
437
|
end # module Appium::Android
|
@@ -63,13 +63,6 @@ module Appium::Common
|
|
63
63
|
result
|
64
64
|
end
|
65
65
|
|
66
|
-
# Find by id. Useful for selendroid
|
67
|
-
# @param id [String] the id to search for
|
68
|
-
# @return [Element]
|
69
|
-
def id id
|
70
|
-
find_element :id, id
|
71
|
-
end
|
72
|
-
|
73
66
|
# Navigate back.
|
74
67
|
# @return [void]
|
75
68
|
def back
|
@@ -260,4 +253,10 @@ module Appium::Common
|
|
260
253
|
lazy_load_strings
|
261
254
|
@strings_xml[id]
|
262
255
|
end
|
256
|
+
|
257
|
+
# Used to error when finding a single element fails.
|
258
|
+
def raise_no_element_error
|
259
|
+
raise Selenium::WebDriver::Error::NoSuchElementError, 'An element could not be located on the page using the given search parameters.'
|
260
|
+
end
|
261
|
+
|
263
262
|
end # module Appium::Common
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
module Appium
|
3
3
|
# Version and Date are defined on the 'Appium' module, not 'Appium::Common'
|
4
|
-
VERSION = '0.
|
5
|
-
DATE = '2013-09-
|
4
|
+
VERSION = '0.8.0' unless defined? ::Appium::VERSION
|
5
|
+
DATE = '2013-09-19' unless defined? ::Appium::DATE
|
6
6
|
end
|
@@ -5,6 +5,13 @@ module Appium::Ios
|
|
5
5
|
# Find textfield and then secure elements in one server call
|
6
6
|
# to match Android.
|
7
7
|
|
8
|
+
def locate_single_textfield js
|
9
|
+
ele = execute_script(js)
|
10
|
+
ele = ele.first if ele.kind_of? Array
|
11
|
+
raise_no_element_error unless ele.kind_of? Selenium::WebDriver::Element
|
12
|
+
ele
|
13
|
+
end
|
14
|
+
|
8
15
|
# Get an array of textfield texts.
|
9
16
|
# @return [Array<String>]
|
10
17
|
def textfields
|
@@ -21,14 +28,14 @@ module Appium::Ios
|
|
21
28
|
# @return [Textfield]
|
22
29
|
def first_textfield
|
23
30
|
js = textfield_js 'r = r.length > 0 ? $(r[0]) : r;'
|
24
|
-
|
31
|
+
locate_single_textfield js
|
25
32
|
end
|
26
33
|
|
27
34
|
# Get the last textfield element.
|
28
35
|
# @return [Textfield]
|
29
36
|
def last_textfield
|
30
37
|
js = textfield_js 'r = r.length > 0 ? $(r[r.length - 1]) : r;'
|
31
|
-
|
38
|
+
locate_single_textfield js
|
32
39
|
end
|
33
40
|
|
34
41
|
# Get the first textfield that matches text.
|
@@ -39,7 +46,7 @@ module Appium::Ios
|
|
39
46
|
# iOS needs to combine textfield and secure to match Android.
|
40
47
|
if text.is_a? Numeric
|
41
48
|
js = textfield_js "r = r.length > 0 ? $(r[#{text}]) : r;"
|
42
|
-
return
|
49
|
+
return locate_single_textfield js
|
43
50
|
end
|
44
51
|
|
45
52
|
textfield_include text
|
@@ -54,8 +61,7 @@ module Appium::Ios
|
|
54
61
|
var s = au.getElementsByXpath('secure[contains(@text, "#{text}")]').value;
|
55
62
|
t.concat(s)[0];
|
56
63
|
)
|
57
|
-
|
58
|
-
execute_script js
|
64
|
+
locate_single_textfield js
|
59
65
|
end
|
60
66
|
|
61
67
|
# Get the first textfield that exactly matches text.
|
@@ -68,15 +74,14 @@ module Appium::Ios
|
|
68
74
|
var s = au.getElementsByXpath('secure[@text="#{text}"]').value;
|
69
75
|
t.concat(s)[0];
|
70
76
|
)
|
71
|
-
|
72
|
-
execute_script js
|
77
|
+
locate_single_textfield js
|
73
78
|
end
|
74
79
|
|
75
80
|
# @private
|
76
81
|
# Return combined lookup of textfield and secure
|
77
82
|
# with an optional filter. $() wrap is required for .each
|
78
83
|
def textfield_js filter=''
|
79
|
-
|
84
|
+
%Q(
|
80
85
|
var t = au.lookup('textfield');
|
81
86
|
var s = au.lookup('secure');
|
82
87
|
var r = $(t.concat(s));
|
@@ -176,4 +176,13 @@ module Appium::Ios
|
|
176
176
|
def fast_duration
|
177
177
|
0.5
|
178
178
|
end
|
179
|
+
|
180
|
+
# Find by id. Useful for selendroid
|
181
|
+
# @param id [String] the id to search for
|
182
|
+
# @return [Element]
|
183
|
+
def id id
|
184
|
+
lazy_load_strings
|
185
|
+
raise "Invalid id `#{id}`" unless @strings_xml[id]
|
186
|
+
find_element :id, id
|
187
|
+
end
|
179
188
|
end # module Appium::Ios
|
data/release_notes.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
#### v0.7.1 2013-09-09
|
2
|
+
|
3
|
+
- [1e0f36e](https://github.com/appium/ruby_lib/commit/1e0f36e22833246873b6ecb8cc4d2bf3544de2c8) Release 0.7.1
|
4
|
+
- [b611ac6](https://github.com/appium/ruby_lib/commit/b611ac6c361b7044d07d2501ae032784aa891c66) Fix typing on disabled textfield
|
5
|
+
- [d887050](https://github.com/appium/ruby_lib/commit/d887050006dd4e18e8b558b542eb0a090fecf985) xml_keys, xml_values, resolve_id work on iOS
|
6
|
+
- [e148f2a](https://github.com/appium/ruby_lib/commit/e148f2ad746795b7dcf3960ed8f837fad2b78f24) Allow custom URL. Fix #84
|
7
|
+
- [8d6ae78](https://github.com/appium/ruby_lib/commit/8d6ae788006fd9430cc34fc0dc3e390876758a1a) Use our docs not rubydoc.info
|
8
|
+
|
9
|
+
|
1
10
|
#### v0.7.0 2013-09-05
|
2
11
|
|
3
12
|
- [c8f3041](https://github.com/appium/ruby_lib/commit/c8f3041049c2feb9ac85f67e85523118a6ce5a84) Release 0.7.0
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appium_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- code@bootstraponline.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: selenium-webdriver
|