我在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。我有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:引发异常:预期对象
请建议我如何解决这个问题。
发布于 2011-02-23 12:25:03
您需要使用doCommand方法来启动您创建的新命令。THere是http://seleniumhq.org/docs/08_user_extensions.html#using-user-extensions-with-selenium-rc的优秀文档
https://stackoverflow.com/questions/5089748
复制相似问题