title: Why can't I interact with elements within the iframe?
body: <p>I'm trying to parse and manipulate some data via Selenium and Java (using Firefox as a browser and Ubuntu as an OS).</p>
  
  <p>I want to type to <code>&lt;textarea&gt;</code> within an <code>&lt;iframe&gt;</code>:</p>
  
  <p><strong>Main Form:</strong></p>
  
  <pre><code>...
  &lt;a class="sendMessegeLink" onclick="open_iframe('...)" title="someText"&gt;
      &lt;img style="padding-left:5px; vertical-align:middle" src="..."/&gt;
                                 someText
  &lt;/a&gt;
  ...
     &lt;table id="open_iframe_overlay"&gt;&lt;tr&gt;&lt;td&gt;
      &lt;div id="open_iframe_wrapper"&gt;
          &lt;div id="open_iframe_closeButton" onclick="close_iframe()"&gt;&amp;times;&lt;/div&gt;
          &lt;iframe id="open_iframe" scrolling="no"&gt;&lt;/iframe&gt;
      &lt;/div&gt;
      &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
  ...
  </code></pre>
  
  <p><strong>Iframe:</strong></p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="he" lang="he"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Language" content="he" /&gt;
  &lt;meta name="description" content="someText1" /&gt;
  &lt;title&gt;someText2&lt;/title&gt;
  ...
  &lt;body&gt;
  &lt;center&gt;
      &lt;div id="pageBackground"&gt;
          &lt;div id="topBackground"&gt;&lt;/div&gt;
          &lt;div id="formDiv"&gt;
              &lt;form name="myForm" method="post"&gt;
                                       ...
                  &lt;div class="label" style="width:90px"&gt; someText3 &lt;/div&gt;&lt;div id="inputText"&gt;&lt;input type="text" name="messegeTitle" maxlength="50" lang="he" value="someText4" /&gt;&lt;/div&gt;
                  &lt;div class="label" style="width:80px"&gt;someText5&lt;/div&gt;&lt;div id="inputTextArea" style="text-align:right"&gt;
                      &lt;textarea name="messegeBody" lang="he" style="height:82px; margin-bottom:5px"&gt;&lt;/textarea&gt;&lt;br /&gt;
                  &lt;/div&gt;
                  &lt;div id="send"&gt;
                      &lt;input type="button" value="someText6" onclick="this.disabled=true; this.title='... '; if (!submitThis('...','myForm','sendMessage')) {this.disabled=false; this.title=''; return false;}" /&gt;&lt;br /&gt;
                      someText7
                  &lt;/div&gt;
                                      ...
              &lt;/form&gt;
          &lt;/div&gt;&lt;!--formDiv--&gt;
      &lt;/div&gt;&lt;!--pageBackground--&gt;
  &lt;/center&gt;
  &lt;script language="JavaScript" type="text/javascript"&gt;document.myForm.messegeBody.focus();&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>My code to click button that pops the iframe: </p>
  
  <pre class="lang-java prettyprint-override"><code>WebElement tmpElement = driver.findElement(By.cssSelector(".."));
  JavascriptExecutor executor = (JavascriptExecutor)driver; 
  executor.executeScript("arguments[0].click();", tmpElement);
  super.waitForDriver(10);
  </code></pre>
  
  <p>I have tried:</p>
  
  <pre><code>WebDriver pop = driver.switchTo().window(driver.getWindowHandle()); 
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>WebDriver pop = driver.switchTo().frame(0);
  </code></pre>
  
  <p>but:</p>
  
  <pre><code>pop.findElement(By.cssSelector("#inputTextArea&gt;textarea")).sendKeys(".."); 
  </code></pre>
  
  <p>both give me:</p>
  
  <pre><code>org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"css selector","selector":"#inputTextArea&gt;textarea"}
  </code></pre>