title: Using JavaScript from Selenium RC by Java
body: <p>I have the following function in <code>user-extensions.js</code></p>
  
  <pre><code>file:Selenium.prototype.doTypeRepeated = function(locator, text) {
      // All locator-strategies are automatically handled by "findElement"
      var element = this.page().findElement(locator);
  
      // Create the text to type
      var valueToType = text + text;
  
      // Replace the element text with the new text
      this.page().replaceText(element, valueToType);
  };
  </code></pre>
  
  <p>I am using Selenium RC with Java. I have the Java class file "Services_ProcMethodREOI.java". I used the following line in Java file to call the javascript function <code>typeRepeated()</code>:</p>
  
  <pre><code>selenium.getEval("typeRepeated(\"txtAppCode\", \"service5\")");
  //txtAppCode is a textfield and service5 is the inputted text on that textfield
  </code></pre>
  
  <p>When I ran the Java file using eclipse, I found the following error:</p>
  
  <blockquote>
    <p>com.thoughtworks.selenium.SeleniumException: ERROR: Threw an
    exception: Object expected</p>
  </blockquote>
  
  <p>Pls suggest me how can I solve it.</p>