title: Switch to iframe with phantom.js
body: <p>I would like to switch to an iframe using pure phantom.js code</p>
  
  <p>Here is my first attempt</p>
  
  <pre class="lang-js prettyprint-override"><code>var page = new WebPage();
  var url = 'http://www.theurltofectch'
  page.open(url, function (status) {
      if ('success' !== status) {
          console.log("Error");
      } else {
          page.switchToFrame("thenameoftheiframe");
          console.log(page.content);
          phantom.exit();
      }
  });
  </code></pre>
  
  <p>It produces only the source code of the main page. Any idea ?</p>
  
  <p>Notice that the iframe domain is different from the main page domain.</p>