lib/appium_lib/android/espresso/element/generic.rb in appium_lib-11.2.0 vs lib/appium_lib/android/espresso/element/generic.rb in appium_lib-12.0.0.rc1
- old
+ new
@@ -23,23 +23,21 @@
def scroll_to(text)
err = nil
w_s = window_rect
(1..30).each do |_count|
- begin
- action
- .move_to_location(w_s.width / 2, (w_s.height * 2) / 5) # pointer based magic number
- .pointer_down(:left)
- .move_to_location(0, w_s.height / 5)
- .release
- .perform
- sleep 1 # we must wait finish scrolling
+ action
+ .move_to_location(w_s.width / 2, (w_s.height * 2) / 5) # pointer based magic number
+ .pointer_down(:left)
+ .move_to_location(0, w_s.height / 5)
+ .release
+ .perform
+ sleep 1 # we must wait finish scrolling
- return text(text)
- rescue StandardError => e
- err = e
- end
+ return text(text)
+ rescue StandardError => e
+ err = e
end
raise err
end
@@ -50,22 +48,20 @@
def scroll_to_exact(text)
err = nil
w_s = window_rect
(1..30).each do |_count|
- begin
- action
- .move_to_location(w_s.width / 2, (w_s.height * 2) / 5) # pointer based magic number
- .pointer_down(:left)
- .move_to_location(0, w_s.height / 5)
- .release
- .perform
- sleep 1 # we must wait finish scrolling
+ action
+ .move_to_location(w_s.width / 2, (w_s.height * 2) / 5) # pointer based magic number
+ .pointer_down(:left)
+ .move_to_location(0, w_s.height / 5)
+ .release
+ .perform
+ sleep 1 # we must wait finish scrolling
- return text_exact(text)
- rescue StandardError => e
- err = e
- end
+ return text_exact(text)
+ rescue StandardError => e
+ err = e
end
raise err
end
end # module Element