【问题标题】:Running JS functions on Selenium RC .Net在 Selenium RC .Net 上运行 JS 函数
【发布时间】:2010-07-08 13:08:20
【问题描述】:

我有一个 index.html 文件,其中包含 scripts.js

在scripts.js中:

函数添加(arg1, arg2)

{

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

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

return arg1 + arg2;

}

在我的 C# 代码中:

[测试]

公共无效 Tescik()

{

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

}

在 NUnit 中运行时失败:

错误:抛出异常:this.browserbot.getUserWindow().Add 不是函数

有什么建议吗?我有 sel.start() 和 stop()

【问题讨论】:

    标签: c# javascript unit-testing nunit selenium-rc


    【解决方案1】:

    这是this.browserbot.getCurrentWindow()...,而不是...getUserWindow...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-09-02
      • 2012-03-23
      • 2011-05-21
      • 1970-01-01
      • 1970-01-01
      • 2013-04-13
      • 2010-11-21
      • 1970-01-01
      相关资源
      最近更新 更多