appium_lib 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/docs/android_docs.md +92 -92
- data/docs/ios_docs.md +93 -93
- data/lib/appium_lib/common/patch.rb +20 -0
- data/lib/appium_lib/common/version.rb +2 -2
- data/lib/appium_lib/driver.rb +11 -0
- data/lib/appium_lib/ios/element/generic.rb +9 -69
- data/release_notes.md +16 -0
- metadata +2 -2
@@ -1,4 +1,24 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
|
3
|
+
# Add status to WebDriver
|
4
|
+
# https://code.google.com/p/selenium/issues/detail?id=5669
|
5
|
+
class Selenium::WebDriver::Driver
|
6
|
+
def status
|
7
|
+
bridge.status
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class Selenium::WebDriver::Remote::Bridge
|
12
|
+
def status
|
13
|
+
raw_execute :status
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class Selenium::WebDriver::Remote::Bridge
|
18
|
+
command :status, :get, 'status'
|
19
|
+
end
|
20
|
+
# end Add status to WebDriver
|
21
|
+
|
2
22
|
module Appium::Common
|
3
23
|
# Implement useful features for element.
|
4
24
|
class Selenium::WebDriver::Element
|
@@ -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.4.
|
5
|
-
DATE = '2013-05-
|
4
|
+
VERSION = '0.4.1' unless defined? ::Appium::VERSION
|
5
|
+
DATE = '2013-05-20' unless defined? ::Appium::DATE
|
6
6
|
end
|
data/lib/appium_lib/driver.rb
CHANGED
@@ -149,6 +149,17 @@ module Appium
|
|
149
149
|
self # return newly created driver
|
150
150
|
end # def initialize
|
151
151
|
|
152
|
+
# Returns the status payload
|
153
|
+
def status
|
154
|
+
driver.status.payload
|
155
|
+
end
|
156
|
+
|
157
|
+
# Returns the server's version string
|
158
|
+
# @return [String]
|
159
|
+
def server_version
|
160
|
+
status['value']['build']['version']
|
161
|
+
end
|
162
|
+
|
152
163
|
# @private
|
153
164
|
# WebDriver capabilities. Must be valid for Sauce to work.
|
154
165
|
# https://github.com/jlipps/appium/blob/master/app/android.js
|
@@ -41,52 +41,8 @@ module Appium::Ios
|
|
41
41
|
# @param predicate [String] the predicate
|
42
42
|
# @return [String] the completed JavaScript program
|
43
43
|
def first_ele_js predicate
|
44
|
-
<<-JS
|
45
|
-
|
46
|
-
return a.type() === 'UIAElementNil';
|
47
|
-
}
|
48
|
-
|
49
|
-
function search( w ) {
|
50
|
-
var search = "#{predicate}";
|
51
|
-
var a = w.secureTextFields().firstWithPredicate(search);
|
52
|
-
if ( isNil(a) ) {
|
53
|
-
a = w.textFields().firstWithPredicate(search);
|
54
|
-
if ( isNil(a) ) {
|
55
|
-
a = w.buttons().firstWithPredicate(search);
|
56
|
-
if ( isNil(a) ) {
|
57
|
-
a = w.elements().firstWithPredicate(search);
|
58
|
-
}
|
59
|
-
}
|
60
|
-
}
|
61
|
-
|
62
|
-
return a;
|
63
|
-
}
|
64
|
-
|
65
|
-
function search_web( windowIndex ) {
|
66
|
-
var a = undefined;
|
67
|
-
|
68
|
-
try {
|
69
|
-
a = UIATarget.localTarget().frontMostApp().windows()[windowIndex].scrollViews()[0].webViews()[0].elements().firstWithPredicate("#{predicate}");
|
70
|
-
} catch(e) {}
|
71
|
-
|
72
|
-
return a;
|
73
|
-
}
|
74
|
-
|
75
|
-
function run() {
|
76
|
-
var windows = au.mainApp.windows();
|
77
|
-
for (var i = 0, len = windows.length; i < len; i++) {
|
78
|
-
var result = search_web( i );
|
79
|
-
if ( isNil( result ) ) {
|
80
|
-
result = search( windows[ i ] );
|
81
|
-
}
|
82
|
-
if ( ! isNil( result ) ) {
|
83
|
-
return au._returnElems( $( [ result ] ) );
|
84
|
-
}
|
85
|
-
}
|
86
|
-
return au._returnElems( $( [] ) );
|
87
|
-
}
|
88
|
-
|
89
|
-
run();
|
44
|
+
(<<-JS).strip # remove trailing newline
|
45
|
+
au.mainApp.getFirstWithPredicateWeighted("#{predicate}");
|
90
46
|
JS
|
91
47
|
end
|
92
48
|
|
@@ -94,16 +50,8 @@ module Appium::Ios
|
|
94
50
|
# @param predicate [String] the predicate
|
95
51
|
# @return [String] the completed JavaScript program
|
96
52
|
def all_ele_js predicate
|
97
|
-
<<-JS
|
98
|
-
|
99
|
-
var search = "#{predicate}";
|
100
|
-
var a = w.elements().withPredicate(search).toArray();
|
101
|
-
|
102
|
-
if ( a.length === 0 ) {
|
103
|
-
a = [];
|
104
|
-
}
|
105
|
-
|
106
|
-
au._returnElems($(a));
|
53
|
+
(<<-JS).strip # remove trailing newline
|
54
|
+
au.mainApp.getAllWithPredicate("#{predicate}");
|
107
55
|
JS
|
108
56
|
end
|
109
57
|
|
@@ -112,10 +60,7 @@ module Appium::Ios
|
|
112
60
|
# @return [Element] the first matching element
|
113
61
|
def find text
|
114
62
|
js = first_ele_js "name contains[c] '#{text}' || label contains[c] '#{text}' || value contains[c] '#{text}'"
|
115
|
-
|
116
|
-
ele = execute_script(js).first
|
117
|
-
raise Selenium::WebDriver::Error::NoSuchElementError, '' if ele.nil?
|
118
|
-
ele
|
63
|
+
execute_script js
|
119
64
|
end
|
120
65
|
|
121
66
|
# Return all elements matching text.
|
@@ -125,7 +70,6 @@ module Appium::Ios
|
|
125
70
|
# returnElems requires a wrapped $(element).
|
126
71
|
# must call toArray when using withPredicate instead of firstWithPredicate.
|
127
72
|
js = all_ele_js "name contains[c] '#{text}' || label contains[c] '#{text}' || value contains[c] '#{text}'"
|
128
|
-
|
129
73
|
execute_script js
|
130
74
|
end
|
131
75
|
|
@@ -134,8 +78,7 @@ module Appium::Ios
|
|
134
78
|
# @return [Element] the first matching element
|
135
79
|
def text text
|
136
80
|
js = first_ele_js "value contains[c] '#{text}'"
|
137
|
-
|
138
|
-
execute_script(js).first
|
81
|
+
execute_script js
|
139
82
|
end
|
140
83
|
|
141
84
|
# Return all elements matching text.
|
@@ -144,8 +87,7 @@ module Appium::Ios
|
|
144
87
|
def texts text
|
145
88
|
# XPath //* is not implemented on iOS
|
146
89
|
# https://github.com/appium/appium/issues/430
|
147
|
-
|
148
|
-
|
90
|
+
js = all_ele_js "value contains[c] '#{text}'"
|
149
91
|
execute_script js
|
150
92
|
end
|
151
93
|
|
@@ -164,11 +106,9 @@ module Appium::Ios
|
|
164
106
|
# @param name [String] the name to search for
|
165
107
|
# @return [Array<Element>] all matching elements
|
166
108
|
def names name
|
167
|
-
#
|
168
|
-
# it's case sensitive and exact on iOS and not on Android.
|
109
|
+
# :name is not consistent across iOS and Android so use custom JavaScript
|
169
110
|
# https://github.com/appium/appium/issues/379
|
170
|
-
js = all_ele_js "name contains[c] '#{name}' || label contains[c] '#{name}'
|
171
|
-
|
111
|
+
js = all_ele_js "name contains[c] '#{name}' || label contains[c] '#{name}'"
|
172
112
|
execute_script js
|
173
113
|
end
|
174
114
|
end # module Appium::Ios
|
data/release_notes.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
#### v0.4.0 2013-05-16
|
2
|
+
|
3
|
+
- [70a59fe](https://github.com/appium/ruby_lib/commit/70a59fefcaa4f16ba0e7629f16feaae3e5f8c424) Release 0.4.0
|
4
|
+
- [b30548e](https://github.com/appium/ruby_lib/commit/b30548e58783bc6b20bd5c0f11e2ae9ddb5faa30) Translate mobile find on Android
|
5
|
+
- [1ea8b85](https://github.com/appium/ruby_lib/commit/1ea8b85ebb7c7531c2791f3c41d0280d947edad0) Screenshot should work on iOS
|
6
|
+
- [3797644](https://github.com/appium/ruby_lib/commit/3797644874ff1e56a8c35f9825e42c8486902984) Update docs
|
7
|
+
- [0e2c119](https://github.com/appium/ruby_lib/commit/0e2c119199535a2e9a8e708453fa068c6445e6ca) Fix release notes
|
8
|
+
- [5c28a2d](https://github.com/appium/ruby_lib/commit/5c28a2debcd8386aab62b48d0b087ed7dac84d8d) Next release will be 0.4.0
|
9
|
+
- [b9e5044](https://github.com/appium/ruby_lib/commit/b9e5044ddf6f998c09f006d8a6d95a5560f2fdd3) Remove comment
|
10
|
+
- [30c2ada](https://github.com/appium/ruby_lib/commit/30c2adaecb0bca734664192a805968a83f4b7a8b) Update doc links
|
11
|
+
- [d08cd59](https://github.com/appium/ruby_lib/commit/d08cd5944aeda9fa3f3842fd5a259e0385b88166) Add JS doc gen
|
12
|
+
- [61530fb](https://github.com/appium/ruby_lib/commit/61530fb908822cd32be6cb25d94ffb00f68ec87b) Update docs
|
13
|
+
- [ebe6a2f](https://github.com/appium/ruby_lib/commit/ebe6a2fa91a748c0c823dbb969afa51ab3710acd) Update docs.md
|
14
|
+
- [637fef7](https://github.com/appium/ruby_lib/commit/637fef7f7547e6e2b2fd8f70e19ef3f3870cc136) Use element.displayed? not visible
|
15
|
+
|
16
|
+
|
1
17
|
#### v0.3.16 2013-05-14
|
2
18
|
|
3
19
|
- [fb34a03](https://github.com/appium/ruby_lib/commit/fb34a03ceec0be552f218323bf266fda7f7e060b) Release 0.3.16
|
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.
|
4
|
+
version: 0.4.1
|
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-05-
|
11
|
+
date: 2013-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: selenium-webdriver
|