【问题标题】:How do I assert an element contains the specified text in FluentAutomation?如何断言元素包含 FluentAutomation 中的指定文本?
【发布时间】:2016-08-04 12:24:29
【问题描述】:

是否可以使用 FluentAutomation 框架检查文本是否包含在元素的文本中?

文档中提供的示例用于匹配精确文本 http://fluent.stirno.com/docs/#asserts-text

I.Assert.Text("FluentAutomation").In("header"); 

如何检查元素是否包含文本?

例如: 标题文本是“我不需要 Mytext 等的随机文本”

我想使用 FluentAutomation 断言标题包含“MyText”

【问题讨论】:

    标签: contains assert fluentautomation


    【解决方案1】:

    我用过Assert.Truehttp://fluent.stirno.com/docs/#asserts-true 并评估我是否找到包含所需字符串的元素:

    I.Assert.True(() => I.Find(MyElement).Text().Contains("teststring"));
    

    【讨论】:

      猜你喜欢
      • 2015-12-29
      • 1970-01-01
      • 2018-04-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-10
      • 1970-01-01
      相关资源
      最近更新 更多