I'm using phantomjs(1.5) and casperjs for my functional tests.
casper = require('casper').create
loadImages: false
casper.start 'http://vk.com', ->
@fill 'form[name="login"]', { email: mail, pass: pass}, true
casper.thenOpen "http://vk.com/#{app}", ->
@echo "User at #{app}"
casper.then ->
@click "iframe['element']" #?! how I can do it?
casper.then ->
@wait 2000000, -> @echo "exit from room: #{num}"
casper.run()
So, I login to vk.com (social network in Russia), my app loaded with iframe.
How I can use elements in iFrame, for example click to a button?
The recent versions of PhantomJS allow us to use the --web-security=no flag for non respect the security policy.
The next script (only PhantomJS) get the title of a link in the iframe, an iframe (adsense).
Remember, run with the parameter
phantomjs --web-security=no iframe.js http://anysite.org
If your application is on a different domain than the one in the iframe, then your script can't interact with the iframe's contents. See: Can scripts in iframe interact with scripts in the main page