Reputation: 37766
I have the following function in user-extensions.js
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);
};
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 typeRepeated()
:
selenium.getEval("typeRepeated(\"txtAppCode\", \"service5\")");
//txtAppCode is a textfield and service5 is the inputted text on that textfield
When I ran the Java file using eclipse, I found the following error:
com.thoughtworks.selenium.SeleniumException: ERROR: Threw an exception: Object expected
Pls suggest me how can I solve it.
Upvotes: 0
Views: 1038
Reputation: 22418
You need to use the doCommand method to fire off your new command that you have created. THere is good documentation at http://seleniumhq.org/docs/08_user_extensions.html#using-user-extensions-with-selenium-rc
Upvotes: 4