2011-02-23 113 views
0

我在user-extensions.js硒RC在Java

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); 
}; 

我使用硒RC与Java下面的函数。我有Java类文件“Services_ProcMethodREOI.java”。我使用的Java文件中的以下行来调用javascript函数typeRepeated()

selenium.getEval("typeRepeated(\"txtAppCode\", \"service5\")"); 
//txtAppCode is a textfield and service5 is the inputted text on that textfield 

当我使用eclipse跑Java文件,我发现了以下错误:

com.thoughtworks.selenium.SeleniumException: ERROR: Threw an exception: Object expected

PLS建议我哪能解决这个问题。

回答