【问题标题】:How to find out that the element does not have the attribute with certain value如何找出元素不具有特定值的属性
【发布时间】:2021-06-30 17:25:12
【问题描述】:

在我的 webdriverIO 脚本中,我需要断言一个表格单元格有一个属性为 title="value1" 的子元素,并且没有一个 title="value2" 的子元素。至于任务的第一部分我使用命令

expect(surveyCells[5].$('img')).toHaveAttr('title', 'Preview - Desktop Survey');

但是任务的第二部分我需要断言该元素没有 title='Preview - Mobile Survey' 的子元素,如下所示:

expect(surveyCells[5].$('img')).doesNotHaveAttr('title', 'Preview - Mobile Survey');

【问题讨论】:

    标签: javascript jquery css selenium webdriver-io


    【解决方案1】:

    你试过了吗:

    expect(surveyCells[5].$('img')).not.toHaveAttr('title', 'Preview - Desktop Survey');
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-04-24
      • 2013-06-03
      • 2012-01-16
      • 2016-07-21
      • 1970-01-01
      • 1970-01-01
      • 2014-08-17
      相关资源
      最近更新 更多