Cross Domain IFrame

349 views
Skip to first unread message

slobo

unread,
Jul 5, 2017, 7:15:50 PM7/5/17
to NightwatchJs
I'm unable to access elements inside crossdomain iframe on anything but Internet Explorer. 

Same test works on all browsers if iframe is loaded from same domain, but this is not possible for us (trying to click through Stripe Checkout form).

Is there a way for nightwatch to ask browsers to drop their guard? Or is this a selenium/webdriver issue? my google-foo not good today, can only finds 5 year old references to resolved issues...

Thanks

David Linse

unread,
Jul 5, 2017, 7:37:52 PM7/5/17
to nightw...@googlegroups.com
afaik the domain in request / webserver must allow this. i think chrome and the like reject this as CSRF request. for this the 'allow-domain' header must be set appropriately.

hope all of this takes sense.. ^^

regards



slobo

unread,
Jul 6, 2017, 3:15:14 AM7/6/17
to NightwatchJs
Thanks for the hint, learned a lot following down the rabbit hole of trying to disable same-origin in chromedriver.  (tried passing various "chromeOptions": {"args": [] }  as described at https://peter.sh/experiments/chromium-command-line-switches/ ). Finally, I tried to replicate the problem by creating a minimal test case and looking at which headers might be causing this.

It turns out that there is no problem accessing the iframe from different origin, but instead new version of stripe checkout (iframe in question) with different element id's was served to Chrome and Firefox. D'oh! (To my defense, I was using Chromium to inspect the page, wouldn't have thought it would be treated as different than full Google Chrome...)

Cheers
Reply all
Reply to author
Forward
0 new messages