user-extension.jsを使用してセレンRCを拡張しています。 新しいメソッド関数を呼び出すことはできますが、次のエラーメッセージがスローされます。新しいメソッドでSelenium RCを拡張する
*ERROR: Command execution failure. Please search the forum at http://clearspace.openqa.org for error details from the log window. The error message is: Object doesn't support this property or method*
このプログラムはGoogle.comで実行されるため、サンプルコードをコピーしてそれぞれのPCで実行できます。
package package1;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.*;
import com.thoughtworks.selenium.*;
public class Sample2
{
private static final String Timeout = "30000";
private static final String BASE_URL = "http://google.com/";
private static final String BASE_URL_1 = "/";
private Selenium selenium;
private HttpCommandProcessor proc;
@BeforeClass
protected void setUp()throws Exception
{
proc = new HttpCommandProcessor("localhost", 4444, "*iexplore", BASE_URL);
selenium = new DefaultSelenium(proc);
selenium.start();
selenium.windowFocus();
selenium.windowMaximize();
selenium.windowFocus();
}
@AfterClass(alwaysRun=true)
protected void tearDown() throws Exception
{
selenium.stop();
}
@Test(groups="search")
public void test_GoogleSearch() throws Exception
{
selenium.open(BASE_URL_1);
selenium.type("name=q", "Bharath Marrivada");
//selenium.click("btnG");
proc.doCommand("myMethod",new String[] {"btnG"}); //user extension
Thread.sleep(5000);
}
}
user-extension.js
Selenium.prototype.doMyMethod = function(inputParams)
{
this.browserbot.click("btnG");
return null;
};
.js
セレンJARは同じフォルダにあり、次のコマンドを使用してセレンJARを実行します。
java -jar selenium-server.jar -userExtensions user-extensions.js
この問題に関するお手伝いはありますか?