@@ -140,7 +140,7 @@ def self.symbolize_keys(hash)
140
140
fail 'symbolize_keys requires a hash' unless hash . is_a? Hash
141
141
result = { }
142
142
hash . each do |key , value |
143
- key = key . to_sym rescue key
143
+ key = key . to_sym rescue key # rubocop:disable Style/RescueModifier
144
144
result [ key ] = value . is_a? ( Hash ) ? symbolize_keys ( value ) : value
145
145
end
146
146
result
@@ -216,8 +216,6 @@ def self.promote_appium_methods(class_array)
216
216
end
217
217
218
218
class Driver
219
- @@loaded = false
220
-
221
219
# attr readers are promoted to global scope. To avoid clobbering, they're
222
220
# made available via the driver_attributes method
223
221
#
@@ -232,6 +230,9 @@ class Driver
232
230
# Export session id to textfile in /tmp for 3rd party tools
233
231
attr_accessor :export_session
234
232
# Default wait time for elements to appear
233
+ # Returns the default client side wait.
234
+ # This value is independent of what the server is using
235
+ # @return [Integer]
235
236
attr_accessor :default_wait
236
237
# Array of previous wait time values
237
238
attr_accessor :last_waits
@@ -246,6 +247,10 @@ class Driver
246
247
# Boolean debug mode for the Appium Ruby bindings
247
248
attr_accessor :appium_debug
248
249
250
+ # Returns the driver
251
+ # @return [Driver] the driver
252
+ attr_reader :driver
253
+
249
254
# Creates a new driver
250
255
#
251
256
# ```ruby
@@ -327,14 +332,6 @@ def initialize(opts = {})
327
332
# Save global reference to last created Appium driver for top level methods.
328
333
$driver = self
329
334
330
- # Promote exactly once the first time the driver is created.
331
- # Subsequent drivers do not trigger promotion.
332
- unless @@loaded
333
- @@loaded = true
334
- # Promote only on Minitest::Spec (minitest 5) by default
335
- Appium . promote_appium_methods ::Minitest ::Spec
336
- end
337
-
338
335
self # return newly created driver
339
336
end
340
337
@@ -436,12 +433,6 @@ def restart
436
433
start_driver
437
434
end
438
435
439
- # Returns the driver
440
- # @return [Driver] the driver
441
- def driver
442
- @driver
443
- end
444
-
445
436
# Takes a png screenshot and saves to the target path.
446
437
#
447
438
# Example: screenshot '/tmp/hi.png'
@@ -457,6 +448,7 @@ def screenshot(png_save_path)
457
448
# @return [void]
458
449
def driver_quit
459
450
# rescue NoSuchDriverError or nil driver
451
+ # rubocop:disable Style/RescueModifier
460
452
@driver . quit rescue nil
461
453
end
462
454
@@ -475,6 +467,7 @@ def start_driver
475
467
476
468
# export session
477
469
if @export_session
470
+ # rubocop:disable Style/RescueModifier
478
471
File . open ( '/tmp/appium_lib_session' , 'w' ) do |f |
479
472
f . puts @driver . session_id
480
473
end rescue nil
@@ -523,13 +516,6 @@ def set_wait(timeout = nil)
523
516
@driver . manage . timeouts . implicit_wait = timeout
524
517
end
525
518
526
- # Returns the default client side wait.
527
- # This value is independent of what the server is using
528
- # @return [Integer]
529
- def default_wait
530
- @default_wait
531
- end
532
-
533
519
# Returns existence of element.
534
520
#
535
521
# Example:
0 commit comments