title: PHPUnit - Selenium 2: How to select an iframe without id and name?
body: <p>I'm trying to select an iframe with PHPUnit Selenium, but somehow it seems not to work. This is the code:</p>
  
  <pre><code>&lt;body&gt;
  ...
  &lt;div id="container"&gt;
  &lt;iframe src="x.html"&gt;
      &lt;html&gt;
      ...
      &lt;body&gt;&lt;/body&gt; &lt;!-- this is the body I would like to get --&gt;
      ...
      &lt;/html&gt;
  &lt;/iframe&gt;
  &lt;/div&gt;
  ...
  &lt;/body&gt;
  </code></pre>
  
  <p>And the PHP:</p>
  
  <pre><code>&lt;?php
  class Test extends PHPUnit_Extensions_Selenium2TestCase {
  
      public function testIframe() {
  
          $theFrame = $this-&gt;byCssSelector('#container iframe');
  
          $this-&gt;frame($theFrame-&gt;getId());
  
          $this-&gt;byCssSelector('body')-&gt;text('test');
  
      }
  }
  </code></pre>
  
  <p>If I check the $theFrame variable, it is an PHPUnit_Extensions_Selenium2TestCase_Element with id=5, but somehow the $this->frame($theFrame->getId()) throws an error:</p>
  
  <pre><code>PHPUnit_Extensions_Selenium2TestCase_WebDriverException: Unable to locate frame: 5
  Command duration or timeout: 32 milliseconds
  Build info: version: '2.31.0', revision: '1bd294d', time: '2013-02-27 20:52:59'
  System info: os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-39-generic',         
  java.version: '1.7.0_17'
  Session ID: 0192c3aa-d4a2-4c9d-bcca-bbd7139dd8c3
  Driver info: org.openqa.selenium.firefox.FirefoxDriver
  Capabilities [{platform=LINUX, databaseEnabled=true, cssSelectorsEnabled=true,     
  javascriptEnabled=true, acceptSslCerts=true, handlesAlerts=true, browserName=firefox,     
  browserConnectionEnabled=true, nativeEvents=false, webStorageEnabled=true, 
  rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true,     
  takesScreenshot=true, version=20.0}]
  </code></pre>
  
  <p>Do you have any idea of why?</p>