From 101bad0aa68f9d2a044f7b78ae9d201f7a156995 Mon Sep 17 00:00:00 2001 From: Scott Dixon Date: Wed, 8 Jun 2016 14:10:54 -0700 Subject: [PATCH] README: cross-domain iframes --- .../advanced-concepts/cross-domain-iframes.md | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 docs/en/advanced-concepts/cross-domain-iframes.md diff --git a/docs/en/advanced-concepts/cross-domain-iframes.md b/docs/en/advanced-concepts/cross-domain-iframes.md new file mode 100644 index 000000000..094e4be53 --- /dev/null +++ b/docs/en/advanced-concepts/cross-domain-iframes.md @@ -0,0 +1,35 @@ +## Cross-domain iFrame Automation + +[Same-origin policy](https://en.wikipedia.org/wiki/Same-origin_policy) prevents Appium from automating iFrames that have a different domain to the parent. + +### Subdomain workaround +If the parent and the iFrame share the same domain (e.g. `site.com` and `shop.site.com`), you can +set `document.domain` on both the parent and each iFrame to a common domain. This solves the same-origin policy issue and allows automation. For example: + +Parent: +``` + + + + + + + + +``` + +Child iFrame: +``` + + + + + +

This is an iFrame!

+ + +```