title: Selenium: How to prepend data to a text box or text Area
body: <p>I am using Selenium Web driver. I have a Text Area where some text is written. Now How can I <strong>prepend</strong> some text/html in it or inserting a data at a specific location?</p>
  
  <p>The following code <strong>appends</strong> it to the text Area/ Text Box</p>
  
  
  
  <pre class="lang-java prettyprint-override"><code>driver.findElement(By.xpath("textBox/textArea")).sendKeys("abc");
  </code></pre>
  
  <p>ie. if the text area/ text box contains 123. The result of above would be <strong>123abc</strong>. But I want <strong>abc123 or 12abc3</strong></p>
  
  <p>PS: I am testing an "Email Reply" functionality. So as a user, when you reply to a mail, you do not do copy text, then clear all text then copy all the text back after writing the new text like below:</p>
  
  <pre class="lang-java prettyprint-override"><code>WebElement element = driver.findElement(By.xpath("textBox/textarea"));
  String previousText = element.getAttribute("value");
  element.clear();
  element.sendKeys("abc" + previousText);
  </code></pre>
  
  <p>Please help...</p>