appium_lib 0.0.23 → 0.0.24

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWVhYjA2OGY2OWM5N2UxMTYxZTY3ODcwNzQwMmY0ZjMxNjU2OTI2ZA==
4
+ ZGMzOGY4Y2FmMTY5MzgyZGNkNzc5YmQyYjU3NjdkNDk3ZDY2MWI0MA==
5
5
  data.tar.gz: !binary |-
6
- NDdkMDk5ZmYyMTMzYzNiYjA4ZjJiMzA4YjA5MDk4NzI3NjAyMWIzMw==
6
+ MjQ0MDc0YjNlN2NhNDFjNTk2MWJmOWUyZWUzZGE4OWU4MTc1YTBjYg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YWJmOGYwNGFlYWI5NjQ3OTVkYzQ5ZjNmNWZhZmU0M2JhOGI2NDVmNzU2Yzhm
10
- YmU3ZDVmZDFkZDMzZmY3NWFkNTkzNTk1YTFkYjg1YTNhOTBhZTA0YTg4YTg5
11
- NWZmNDI5ZjdlMWU3OThlNGY0Y2Y5NTg2NGM0ODg0NTE5NTQyMWQ=
9
+ MDIxZTBkMTczNGVmODYyMjcxYWRmNTg0MTMzNGM4YzM1YmM2YzBmNjBmNTg0
10
+ OWU4Mzg2Zjc4ODQ4NWFmNGMwZjYzODMyNTE2MTE1Y2M5ZDQwMmZmMjQ5NmU1
11
+ OWM4YTBmOWJkMmU0NTMzMjA5NTU5NGYzYWQ2NjAzMjkwNDQ0Mzc=
12
12
  data.tar.gz: !binary |-
13
- ZjEwN2U5M2RlNTYyODg2MjUwZDI1ODg0ZDg4MGY0YWZjYjMwYjc2YWZkY2Uw
14
- MGY5N2EyMjE5MWE1YjBlODU5YjI2ZTQ3OTNhOTU0ZWI5YWU5NDA4NGRjMzk0
15
- ZGUyYjdhYzBlZjY4MTc0ZTg3MThhY2MzMjNhYmMyYmY3Nzc5ZGY=
13
+ OWJjYTNkMjE3YzEzNGQ3NDQwY2UxNDc4YTg0MjlkOWFkNTg3ZTA1OWE4NzU1
14
+ ZjA4NGEyNmJiNGM0MTVjNjM2NWQwOWFlMTM0ODI1MTk0OTljNzE0ZWU0YmY5
15
+ ZTgyMjc1MGY2ZTAyOWE1ZWQyOTM0N2IxOGJmM2JiN2E2NzA4ODg=
@@ -29,6 +29,24 @@ def wait &block
29
29
  result
30
30
  end
31
31
 
32
+ # Return the first element matching name.
33
+ # on Android name is content description
34
+ # on iOS name is the accessibility label or the text.
35
+ # @param name [String] the name to search for
36
+ # @return [Element] the first matching element
37
+ def name name
38
+ $driver.find_element :name, name
39
+ end
40
+
41
+ # Return all element matching name.
42
+ # on Android name is content description
43
+ # on iOS name is the accessibility label or the text.
44
+ # @param name [String] the name to search for
45
+ # @return [Array<Element>] all matching elements
46
+ def names name
47
+ $driver.find_elements :name, name
48
+ end
49
+
32
50
  # Presses the back button on Android.
33
51
  # @return [void]
34
52
  def back
@@ -166,6 +184,12 @@ def source
166
184
  ap JSON.parse($driver.page_source)
167
185
  end
168
186
 
187
+ # Gets a JSON view of the current page
188
+ # @return [JSON]
189
+ def get_source
190
+ JSON.parse($driver.page_source)
191
+ end
192
+
169
193
  # iOS only. On Android uiautomator always returns an empty string for EditText password.
170
194
  #
171
195
  # Password character returned from value of UIASecureTextField
@@ -174,3 +198,49 @@ end
174
198
  def password length=1
175
199
  '•' * length
176
200
  end
201
+
202
+ # Android only.
203
+ def get_inspect
204
+ def run node
205
+ r = []
206
+
207
+ run_internal = lambda do |node|
208
+ if node.kind_of? Array
209
+ node.each { |node| run_internal.call node }
210
+ return
211
+ end
212
+
213
+ keys = node.keys
214
+ return if keys.empty?
215
+
216
+ obj = {}
217
+ obj.merge!( { desc: node["@content-desc"] } ) if keys.include?("@content-desc") && !node["@content-desc"].empty?
218
+ obj.merge!( { text: node["@text"] } ) if keys.include?("@text") && !node["@text"].empty?
219
+ obj.merge!( { class: node["@class"] } ) if keys.include?("@class") && !obj.empty?
220
+
221
+ r.push obj if !obj.empty?
222
+ run_internal.call node['node'] if keys.include?('node')
223
+ end
224
+
225
+ run_internal.call node
226
+ r
227
+ end
228
+
229
+ json = JSON.parse($driver.page_source)
230
+ node = json['hierarchy']
231
+ results = run node
232
+
233
+ out = ''
234
+ results.each { |e|
235
+ out += e[:class].split('.').last + "\n"
236
+ out += " text: #{e[:text]}\n" unless e[:text].nil?
237
+ out += " desc: #{e[:desc]}\n" unless e[:desc].nil?
238
+ }
239
+ out
240
+ end
241
+
242
+ # Android only. Intended for use with console.
243
+ def inspect
244
+ puts get_inspect
245
+ nil
246
+ end
@@ -1,4 +1,4 @@
1
1
  module AppiumLib
2
- VERSION = '0.0.23' unless defined? ::AppiumLib::VERSION
3
- DATE = '2013-03-27' unless defined? ::AppiumLib::DATE
2
+ VERSION = '0.0.24' unless defined? ::AppiumLib::VERSION
3
+ DATE = '2013-03-28' unless defined? ::AppiumLib::DATE
4
4
  end
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.0.23
4
+ version: 0.0.24
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-03-27 00:00:00.000000000 Z
11
+ date: 2013-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver