New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to access web elements in a cross-origin (CROS) iframe on IOS mobile browser #2003
Comments
Since appium use the webdriver-atoms to do the testing, CROS cannot be simply supported. You'd either change the page or try to use the reverse proxy method on the testing server to bypass the CROS problem. |
Is this something that can be fixed/handled by Appium? We are currently experiencing the same issue and I am not sure reworking the app to avoid the CROS is feasible. |
we'd have to dig into the remote webkit debug protocol to see if we can get special access to different-origin iframes. I'm skeptical though… This'd be a research project I can't take on right now. @snevesbarros do you have any ideas? |
Guys, I would really appropriate anything you can do on this issue. I have reverted to using WebDriver and Chrome with a mobile user-agent to fool the web app into think its running on a mobile web browser. Its not ideal but at least its something. |
I agree with @bigfei. Appium sends across the atoms (including some arguments) using the webkit protocol. I had a look at the documentation for the protocol but didn't find anything useful. I dont think there is a simple way to support cross domain requests other than fooling the iframe into thinking they are from the same domain (e.g. example here (#2)). |
It would be good if this feature is added to Appium. I would think cross-origin iframe is common in eCommerce apps. For example I need to test credit card iframes from Chase PaymentTech. Thanks. |
If someone can provide me a technique for this that works, I'll add it to the roadmap. |
Hello guys, |
Same problem. and stuck. Some one can help with this? many thanks |
Same problem.Any solution for this issue |
Has anyone tried enabling Access-Control-Allow-Origin: * on the external server to fix this? |
Sounds possible, I will do a test to verify this. @chris-gunawardena |
I tried adding "Access-Control-Allow-Origin: *" using Charles proxy but ran into the same issue. |
In my case I was able to use charles proxy rewrite to inject a script to fill out the login form (which was in another domain) and submit it. Hope this helps. |
i have a question: |
Does anybody got the solution to this issue?? Please help am completely stuck on iOS Mobile browser. |
Seeing the same issue. Seem like a pretty common problem. would be happy to pair with someone if there is any direction to a solution. |
I had a similar problem and worked around this issue by using a reverse proxy that routed traffic based on request paths. I also had to get the test site to change the domain it loads the inner iframe content from. This step really depends on the kind of hooks and configuration capabilities your test environment & product have. I forget the exact details (it was a former job and I have bad memory), but I used Nginx and had a server config that looked something like:
Then I'd point my tests to go to Sorry if the details are scant (and likely wrong), my memory is bad, I've left the previous company, and I don't save my work on my personal machines. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hi,
(Issue ported from https://groups.google.com/forum/#!topic/appium-discuss/vIbhO_KljXc.)
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]
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"}
Regards,
Kieran
The text was updated successfully, but these errors were encountered: