Skip to content

Commit e72c170

Browse files
Remove Selendroid specific code
When Selendroid implements the mobile spec then it won't require special code. https://code.google.com/p/selenium/source/browse/spec-draft.md?repo=mobile
1 parent 4e9f3d6 commit e72c170

File tree

4 files changed

+7
-75
lines changed

4 files changed

+7
-75
lines changed

lib/appium_lib/android/helper.rb

+2-67
Original file line numberDiff line numberDiff line change
@@ -217,71 +217,6 @@ def find_eles_attr tag_name, attribute=nil
217217
mobile :find, array
218218
end
219219

220-
# Selendroid only.
221-
# Returns a string containing interesting elements.
222-
# @return [String]
223-
def get_selendroid_inspect
224-
# @private
225-
def run node
226-
r = []
227-
228-
run_internal = lambda do |node|
229-
if node.kind_of? Array
230-
node.each { |node| run_internal.call node }
231-
return
232-
end
233-
234-
keys = node.keys
235-
return if keys.empty?
236-
237-
obj = {}
238-
# name is id
239-
obj.merge!({ id: node['name'] }) if keys.include?('name') && !node['name'].empty?
240-
obj.merge!({ text: node['value'] }) if keys.include?('value') && !node['value'].empty?
241-
# label is name
242-
obj.merge!({ name: node['label'] }) if keys.include?('label') && !node['label'].empty?
243-
obj.merge!({ class: node['type'] }) if keys.include?('type') && !obj.empty?
244-
obj.merge!({ shown: node['shown'] }) if keys.include?('shown')
245-
246-
r.push obj if !obj.empty?
247-
run_internal.call node['children'] if keys.include?('children')
248-
end
249-
250-
run_internal.call node
251-
r
252-
end
253-
254-
json = get_source
255-
node = json['children']
256-
results = run node
257-
258-
out = ''
259-
results.each { |e|
260-
no_text = e[:text].nil?
261-
no_name = e[:name].nil? || e[:name] == 'null'
262-
next unless e[:shown] # skip invisible
263-
# Ignore elements with id only.
264-
next if no_text && no_name
265-
266-
out += e[:class].split('.').last + "\n"
267-
268-
# name is id when using selendroid.
269-
# remove id/ prefix
270-
e[:id].sub!(/^id\//, '') if e[:id]
271-
272-
out += " class: #{e[:class]}\n"
273-
# id('back_button').click
274-
out += " id: #{e[:id]}\n" unless e[:id].nil?
275-
# find_element(:link_text, 'text')
276-
out += " text: #{e[:text]}\n" unless no_text
277-
# label is name. default is 'null'
278-
# find_element(:link_text, 'Facebook')
279-
out += " name: #{e[:name]}\n" unless no_name
280-
# out += " visible: #{e[:shown]}\n" unless e[:shown].nil?
281-
}
282-
out
283-
end
284-
285220
def get_page_class
286221
r = []
287222
run_internal = lambda do |node|
@@ -404,7 +339,7 @@ def run node
404339
# Returns a string containing interesting elements.
405340
# @return [String]
406341
def get_inspect
407-
@device == 'Selendroid' ? get_selendroid_inspect : get_android_inspect
342+
get_android_inspect
408343
end
409344

410345
# Intended for use with console.
@@ -438,7 +373,7 @@ def current_app
438373
am_start: pkg + '/' + act
439374
end
440375

441-
# Find by id. Useful for selendroid
376+
# Find by id
442377
# @param id [String] the id to search for
443378
# @return [Element]
444379
def id id

lib/appium_lib/common/helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def source
195195
# Gets a JSON view of the current page
196196
# @return [JSON]
197197
def get_source
198-
# must set max nesting. default limit of 20 is too low for selendroid
198+
# must set max nesting. default limit of 20 is too low
199199
JSON.parse @driver.page_source, max_nesting: 9999
200200
end
201201

lib/appium_lib/driver.rb

+3-6
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ class Driver
205205
attr_accessor :global_webdriver_http_sleep
206206

207207
# Creates a new driver.
208-
# :device is :android, :ios, or :selendroid
208+
# :device is :android or :ios
209209
#
210210
# ```ruby
211211
# # Options include:
@@ -417,7 +417,7 @@ def start_driver
417417

418418
begin
419419
@driver = Selenium::WebDriver.for :remote, http_client: @client, desired_capabilities: @caps, url: server_url
420-
# Load touch methods. Required for Selendroid.
420+
# Load touch methods.
421421
@driver.extend Selenium::WebDriver::DriverExtensions::HasTouchScreen
422422

423423
# export session
@@ -430,10 +430,7 @@ def start_driver
430430
raise 'ERROR: Unable to connect to Appium. Is the server running?'
431431
end
432432

433-
# Set timeout to a large number so that Appium doesn't quit
434-
# when no commands are entered after 60 seconds.
435-
# broken on selendroid: https://github.com/appium/appium/issues/513
436-
mobile :setCommandTimeout, timeout: 9999 unless @device == 'Selendroid'
433+
mobile :setCommandTimeout, timeout: 9999
437434

438435
# Set implicit wait by default unless we're using Pry.
439436
@driver.manage.timeouts.implicit_wait = @default_wait unless defined? Pry

lib/appium_lib/ios/helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def fast_duration
192192
0.5
193193
end
194194

195-
# Find by id. Useful for selendroid
195+
# Find by id
196196
# @param id [String] the id to search for
197197
# @return [Element]
198198
def id id

0 commit comments

Comments
 (0)