I’m having trouble with Appium running tests on the web context of our Cordova app when there are shadowRoots.
I’m on XCode 9.1, Appium 1.7.1. iOS 11.1 on a real device.
I think I have the capabilities set up correctly, as I can switch to web context and access the elements that are not under a shadowRoot, but when trying to return a shadowRoot element via execute_script I get:
[HTTP] --> POST /wd/hub/session/86ddb018-2bf3-4eeb-aea1-9b281be31ebb/execute {“script”:“return document.querySelector(“vst-sa-app”).shadowRoot”,“args”:[]}
[MJSONWP] Calling AppiumDriver.execute() with args: [“return document.querySelector(“vst-sa-app”).shadowRoot”,[],“86ddb018-2bf3-4eeb-aea1-9b281be31ebb”]
[XCUITest] Executing command ‘execute’
[RemoteDebugger] Executing ‘execute_script’ atom in default context
[RemoteDebugger] Sending javascript command (function(){return function(){var e=this;
funct…
[RemoteDebugger] Sending WebKit data: {“method”:“Runtime.evaluate”,“params”:{“objectGroup”:“console”,“includeCommandLineAPI”:true,“doNotPauseOnExceptionsAndMuteConsole”:true,“expression”:"(function(){return function(){var e=this;\nfunc…
[RemoteDebugger] Webkit response timeout: 5000
[RemoteDebugger] Receiving WebKit data: ‘{“result”:{“result”:{“type”:“object”,“value”:{“status”:13,“value”:{“message”:“Recursive object cannot be transferred”}}},“wasThrown”:false},“id”:1}’
[RemoteDebugger] Found handler for message ‘1’
[MJSONWP] Encountered internal error running command: Error: Error while executing atom: Recursive object cannot be transferred (status: 13)
Here is some sample (ruby) code to demonstrate the issue:
$driver = Appium::Driver.new({:caps => capabilities}, false).start_driver
webview = $driver.available_contexts.last
$driver.set_context(webview) #correctly sets to the web context
aaa = $driver.execute_script(‘return document.querySelector(“vst-sa-app”)’)
p aaa #just output the element to prove we got something. This one works fine
bbb = $driver.execute_script(‘return document.querySelector(“vst-sa-app”).shadowRoot’) #gives the above error
I can supply more info if anyone is interested. I’d enter a defect but I feel more like I’m just doing something wrong and I’m curious if others are having success with a similar setup.
If anyone has any input, I’m all ears!
Thanks!