Unable to access web elements in a cross-origin iframe on IOS mobile browser

583 views
Skip to first unread message

Kieran Cummins

unread,
Mar 5, 2014, 6:35:46 AM3/5/14
to appium-...@googlegroups.com
Hi,

I have starting using appium for testing of our mobile web app. Unfortunately it runs in an cross-origin iframe and Appium appears to have difficult accessing web elements in the iframe. I have setup a simple test page which contains a local iframe (same domain as parent) and a cross-origin iframe. Appium has no issue with accessing the local iframe content but fails when attempting to access elements within cross-origin iframe. Is this a known issue or does it sound like a bug. My WebDriver tests appear to work using chromedriver. I am new to Appium and was drawing to it as I would not need to change our internal testing framework which is Java/WebDriver based. I am stuck with this issues as our mobile app runs within Salesforce's environment so have no control over the use of iframes.

I see that switching to the cross-origin iframe seems to work, from the logs:

info: Entering new web frame: :wdc:1394013932388 
info: Responding to client with success: {"status":0,"value":{"WINDOW":":wdc:1394013932388"},"sessionId":"539b787f-efa1-4060-b3fb-511549e5be1f"} 

But when I attempt to access an element in the iframe I get the error "undefined' is not an object ", see below:
 
debug: Appium request initiated at /wd/hub/session/539b787f-efa1-4060-b3fb-511549e5be1f/element 
debug: Request received with params: {"using":"xpath","value":"//table[@class='snowrep']"} 
info: [REMOTE] Wrapping script for frame :wdc:1394013932388 
info: [REMOTE] Sending javascript command 
debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger 
debug: [REMOTE] Receiving data from remote debugger 
debug: [REMOTE] Receiving data from remote debugger 
debug: [REMOTE] <applicationSentData response> 
info: Responding to client with error: {"status":13,"value":{"message":"'undefined' is not an object (evaluating 'a.nodeType')","origValue":"'undefined' is not an object (evaluating 'a.nodeType')"},"sessionId":"539b787f-efa1-4060-b3fb-511549e5be1f"} 

So again,not sure if this is a bug, know issue or limitation of the system. Hope its not a limitation as I would really like to use Appium. Any help would be appreciated. 

Regards,
Kieran

---------------------------------------
Log extract below:

info: Responding to client with success: {"status":0,"value":{"ELEMENT":"5005"},"sessionId":"539b787f-efa1-4060-b3fb-511549e5be1f"} 
POST /wd/hub/session/539b787f-efa1-4060-b3fb-511549e5be1f/element 200 13ms - 112b 
debug: Appium request initiated at /wd/hub/session/539b787f-efa1-4060-b3fb-511549e5be1f/frame 
debug: Request received with params: {"id":{"ELEMENT":"5005"}} 
nfo: [REMOTE] Executing 'get_frame_window' atom in default context 
info: [REMOTE] Sending javascript command 
debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger 
debug: [REMOTE] Receiving data from remote debugger 
debug: [REMOTE] <applicationSentData response> 
info: Entering new web frame: :wdc:1394013932388 
info: Responding to client with success: {"status":0,"value":{"WINDOW":":wdc:1394013932388"},"sessionId":"539b787f-efa1-4060-b3fb-511549e5be1f"} 
POST /wd/hub/session/539b787f-efa1-4060-b3fb-511549e5be1f/frame 200 7ms - 125b 
debug: Appium request initiated at /wd/hub/session/539b787f-efa1-4060-b3fb-511549e5be1f/element 
debug: Request received with params: {"using":"xpath","value":"//table[@class='snowrep']"} 
info: [REMOTE] Wrapping script for frame :wdc:1394013932388 
info: [REMOTE] Sending javascript command 
debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger 
debug: [REMOTE] Receiving data from remote debugger 
debug: [REMOTE] Receiving data from remote debugger 
debug: [REMOTE] <applicationSentData response> 
info: Responding to client with error: {"status":13,"value":{"message":"'undefined' is not an object (evaluating 'a.nodeType')","origValue":"'undefined' is not an object (evaluating 'a.nodeType')"},"sessionId":"539b787f-efa1-4060-b3fb-511549e5be1f"} 
POST /wd/hub/session/539b787f-efa1-4060-b3fb-511549e5be1f/element 500 10ms - 238b 
info: Didn't get a new command in 60 secs, shutting down... 
info: Shutting down appium session... 
info: Stopping ios 
debug: [REMOTE] Receiving data from remote debugger 
debug: [REMOTE] Receiving data from remote debugger 
debug: [REMOTE] { __selector: '_rpc_applicationDisconnected:',

Jonathan Lipps

unread,
Mar 5, 2014, 12:43:13 PM3/5/14
to Kieran Cummins, appium-...@googlegroups.com
Hmm, it looks like it could be a bug, though I'm not sure if there's a possible resolution. Could you re-post this as an issue on Appium's github so we can track it?

--
http://appium.io
---
You received this message because you are subscribed to the Google Groups "Appium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appium-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/appium-discuss.
For more options, visit https://groups.google.com/groups/opt_out.

Kieran Cummins

unread,
Mar 6, 2014, 3:50:56 AM3/6/14
to appium-...@googlegroups.com
Will do, thanks Jonathan.
Reply all
Reply to author
Forward
0 new messages