Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/391.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过Java使用Selenium RC中的JavaScript_Java_Javascript_Selenium_Selenium Rc - Fatal编程技术网

通过Java使用Selenium RC中的JavaScript

通过Java使用Selenium RC中的JavaScript,java,javascript,selenium,selenium-rc,Java,Javascript,Selenium,Selenium Rc,我在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 v

我在
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);
};
我将Selenium RC与Java一起使用。我有Java类文件“Services\u ProcMethodREOI.Java”。我使用Java文件中的以下行调用javascript函数
typeRepeated()

当我使用eclipse运行Java文件时,发现以下错误:

com.thoughtworks.selenium.SeleniumException:错误:引发错误 异常:应为对象


请建议我如何解决它。

您需要使用doCommand方法启动您创建的新命令。在

中有很好的文档,您需要使用docomand方法启动您创建的新命令。这里有很好的文档

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