开发者

Running JS functions on Selenium RC .Net

I have a index.html file which includes scripts.js

in scripts.js:

function Add(arg1, arg2)

{

if(typeof(a开发者_如何学JAVArg1) == 'string') arg1 = parseInt(arg1);

if(typeof(arg2) == 'string') arg2 = parseInt(arg2);

return arg1 + arg2;

}

in my C# code:

[Test]

public void Tescik()

{

   Assert.AreEqual(sel.GetEval(@"this.browserbot.getUserWindow().Add(2,3);"), 5, "Adding...");

}

when run in NUnit it fails with:

ERROR: Threw an exception: this.browserbot.getUserWindow().Add is not a function

any suggestions what's wrong? I have both sel.start() and stop()


It's this.browserbot.getCurrentWindow()..., not ...getUserWindow....

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜