appium: Error trying to access shadowRoot elements on iOS

The problem

Can’t access elements under a shadowRoot on iOS real device. We have an automation suite that runs on our Chrome app, and our Mac and Windows Electron apps using Selenium Webdriver. I’m hoping to use much of the same code on our Hybrid iOS app via Appium. We use Polymer and thus have to access elements under shadowRoots. On other platforms, we are doing this via shadowElement = $driver.execute_script(‘return document.querySelector(“blah_blah”).shadowRoot’) el = shadowElement.find_element(:css => “#id_of_my_element”)

This is not working in Appium. I’m getting a “Recursive object cannot be transferred” error.

Environment

Appium 1.7.1 (using Appium desktop app 1.2.7) Mac OS 10.13 Xcode 9.1 iOS 11.1.2 on real iPad Air

Details

I believe I have the capabilities set up correctly, as I can switch to the web context and access the elements above the shadowRoot elements.
When running the sample code below I get the error: “[MJSONWP] Encountered internal error running command: Error: Error while executing atom: Recursive object cannot be transferred (status: 13)”

Link to Appium logs

https://gist.github.com/dyhopper1/0df126924abfd093ae02c80fc71a5fc4

Code To Reproduce Issue [ Good To Have ]

(Sample ruby code)

`capabilities = { “bundleId”=> “com.vernier.spectralanalysis”, “udid” => “1905da18d1c56349efb55ab04xxxxxxxxxxxxxxx”, “platformName” => “iOS”, “deviceName” => “iPad Air”, “platformVersion” => “11.1”, “xcodeOrgId” => “xxxxxxxxxx”, “xcodeSigningId” => “iPhone Developer”, “startIWDP” => true }

$driver = Appium::Driver.new({:caps => capabilities}, false).start_driver sleep 4 webview = $driver.available_contexts.last $driver.set_context(webview) #works

el = $driver.execute_script(‘return document.querySelector(“vst-sa-app”)’) p el # just to prove the element was retrieved successfully. no problem.

#the following line results in error shadowEl = $driver.execute_script(‘return document.querySelector(“vst-sa-app”).shadowRoot’)

`

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 26 (8 by maintainers)

Most upvoted comments