automated-tests - Watin 和 Fluent 自动化 - 引用当前浏览器

标签 automated-tests watin functional-testing fluentautomation

我在项目中使用 Fluent Automation 来创建更多人类可读的测试。此处提供信息 http://fluent.stirno.com/并在 GitHub 上:https://github.com/stirno/FluentAutomation

我需要能够执行一些未通过流畅自动化实现的操作,并且希望能够掌握浏览器或 WatiN 元素。我实际上正在尝试运行 LINQ 查询,如下所示:

var indicators = from i in this.CurrentBrowser.Links
where i.Url.Contains("LeadsMine.aspx?flag")
select i;

有什么想法吗?

提前谢谢您!

最佳答案

仅供以后可能发现此内容的人引用。作为Fluent Automation GitHub Issue的一部分,我们讨论了如何处理这个问题。 ,有几个不同的解决方案。

理想情况下,任何用户交互都将使用实际的 I.Click("#button") 类型操作来处理,但在像这样的边缘情况下,您有类似 plugin/flash/java 的东西基于/you-name-it 的 UI 元素,您需要:

  1. 添加扩展方法来支持此功能,如 lstanczyk 所做的那样,或者
  2. 在不可见或屏幕外的元素上执行诸如单击事件之类的操作,并通过 onclick 触发 JavaScript API 来与插件配合使用。

lstanczyk 自己的解决方案是添加一个扩展方法:

public static void RunScript(this FluentAutomation.Interfaces.INativeActionSyntaxProvider I, string scriptCode)
{
    FluentAutomation.Element bodyTag = I.Find("body").Invoke() as FluentAutomation.Element;
    bodyTag.AutomationElement.DomContainer.RunScript(scriptCode);
}

然后使用 I.RunScript(script); 调用它,其中 script 是字符串中的 JavaScript。

关于automated-tests - Watin 和 Fluent 自动化 - 引用当前浏览器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11938938/

相关文章:

javascript - 获取使用 Jest 运行的测试列表(不运行套件)

testing - 您如何针对多个服务器有效地运行测试自动化以进行验证?

java - Maven 2 多模块 pom

visual-studio-2008 - 在 VSTestHost 下运行 WatiN 测试的线程问题

unit-testing - 您如何决定在您的测试套件中测试什么?

android - 葫芦安卓 : how to run or execute tests on all connected devices?

tdd - 依赖数据的 BDD 测试的最佳策略是什么

jenkins - 什么工具可以测试复杂的多进程系统?

android - 使用 Mockito 和 Dagger 的 SharedPreferences

Watin 和新 IE 上的光标