title: How to type text on hidden text box in WebDriver with Java
body: <p>I am trying to sendkeys to an input，but I don't know why it warns me like this:</p>
  
  <blockquote>
    <p>org.openqa.selenium.InvalidElementStateException: Element must not be hidden, disabled or read-only (WARNING: The server did not provide any stacktrace information)</p>
  </blockquote>
  
  <p>The HTML page source:</p>
  
  <pre><code>&lt;span id="mini-7" class="mini-textbox mini-textbox-empty" style="border-width: 0pt; width: 342px;"&gt;
  &lt;input class="mini-textbox-input" type="text" autocomplete="off" style="width: 338px;"&gt;
  &lt;input type="hidden"&gt;
  &lt;/span&gt;
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>driver.findElement(By.cssSelector("#mini-7 &gt; input.mini-textbox-input")).clear();
  driver.findElement(By.cssSelector("#mini-7 &gt; input.mini-textbox-input")).sendKeys("yy");
  </code></pre>
  
  <p>Then I change my code like this:</p>
  
  <pre><code>JavascriptExecutor jse = (JavascriptExecutor)driver;
  ((JavascriptExecutor) jse).executeScript("arguments[0].type ='text';",driver.findElement(By.xpath("//span[@id='mini-7']/input[2]")));   
  </code></pre>
  
  <p>But this time it throws out js error. Why?</p>
  
  <p>I use sendkeys to the first input，this input is not hidden</p>