File tree 1 file changed +13
-3
lines changed
1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -49,10 +49,20 @@ def name
49
49
# https://github.com/appium/appium/wiki/Automating-mobile-gestures
50
50
# @return [OpenStruct] the relative x, y in a struct. ex: { x: 0.50, y: 0.20 }
51
51
def location_rel
52
- xy = self . location
52
+ location = self . location
53
+ location_x = location . x . to_f
54
+ location_y = location . y . to_f
55
+
56
+ size = self . size
57
+ size_width = size . width . to_f
58
+ size_height = size . height . to_f
59
+
60
+ center_x = location_x + ( size_width / 2.0 )
61
+ center_y = location_y + ( size_height / 2.0 )
62
+
53
63
w = $driver. window_size
54
- OpenStruct . new ( x : "#{ xy . x . to_f } / #{ w . width . to_f } " ,
55
- y : "#{ xy . y . to_f } / #{ w . height . to_f } " )
64
+ OpenStruct . new ( x : "#{ center_x } / #{ w . width . to_f } " ,
65
+ y : "#{ center_y } / #{ w . height . to_f } " )
56
66
end
57
67
end
58
68
end # module Appium::Common
You can’t perform that action at this time.
0 commit comments