开发者

Running JS functions on Selenium RC .Net

开发者 https://www.devze.com 2023-01-05 23:31 出处:网络
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);

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

精彩评论

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