【发布时间】:2011-02-23 10:38:46
【问题描述】:
我在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);
};
我在 Java 中使用 Selenium RC。我有 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: 错误: 抛出一个 异常:预期对象
请建议我如何解决它。
【问题讨论】:
标签: java javascript selenium selenium-rc