【问题标题】:How to remove an element's attribute in phpunit selenium test?如何在 phpunit selenium 测试中删除元素的属性?
【发布时间】:2017-10-21 00:44:29
【问题描述】:

无论如何要从元素中删除属性。我的意思不是简单地将其设置为空字符串。

例如通过删除类属性:

<a class='c'> => <a>

我正在使用 selenium 2.5。

【问题讨论】:

    标签: php selenium phpunit


    【解决方案1】:

    我找到了解决方案。它并不完美,它执行JS来改变元素。

    使用 JQuery:

    $this->execute(array(
         'script' => "$('#element').removeAttr('class');",
         'args' => array()
    ));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-05-11
      • 2015-02-21
      • 2019-04-21
      • 2011-09-21
      • 2021-09-18
      • 1970-01-01
      • 2012-12-07
      • 2016-01-22
      相关资源
      最近更新 更多