Skip to content

Commit 631c584

Browse files
.location_rel now returns a fraction
Fix #76 px_to_window_rel returns a string fraction
1 parent bf45140 commit 631c584

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/appium_lib/common/helper.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ def px_to_window_rel opts={}
223223
x = opts.fetch :x, 0
224224
y = opts.fetch :y, 0
225225

226-
OpenStruct.new( x: x.to_f / w.width.to_f,
227-
y: y.to_f / w.height.to_f )
226+
OpenStruct.new( x: "#{x.to_f} / #{w.width.to_f}",
227+
y: "#{y.to_f} / #{w.height.to_f}" )
228228
end
229229

230230
def lazy_load_strings

lib/appium_lib/common/patch.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def tag_name
5858
def location_rel
5959
xy = self.location
6060
w = $driver.window_size
61-
OpenStruct.new( x: xy.x.to_f / w.width.to_f,
62-
y: xy.y.to_f / w.height.to_f )
61+
OpenStruct.new( x: "#{xy.x.to_f} / #{w.width.to_f}",
62+
y: "#{xy.y.to_f} / #{w.height.to_f}" )
6363
end
6464
end
6565
end # module Appium::Common

0 commit comments

Comments
 (0)