Exchanging ruby and javascript objects in execute_script

I am ruby and appium newbie, so excuse for asking the obvious

  • I would like to exchange javascript and ruby objects like they are done in Selenium WebDriver
# pass elements between Ruby and JavaScript
element = driver.execute_script("return document.body")
driver.execute_script("return arguments[0].tagName", element) #=> "BODY"
  • In my case here is a sample for iOS:
# find cell1 and check it's x & y coordinate
cell1 = execute_script('UIATarget.localTarget().frontMostApp().mainWindow().tableViews()[0].cells()[0]')
cell1_X = execute_script('args[0].rect().origin.x',cell1)

Any help would be appreciated.

Regards

try

cell1_X = execute_script(‘args[0].rect().origin.x’,cell1.ref)

or this:

cell1_X = execute_script("au.getElement(#{cell1.ref}).rect().origin.x")