0

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.

1 Answer 1

4

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.