Codeception验收测试如何找到css伪类元素

Codeception Acceptance Test How to find css Pseudo classes element

我的测试Html像这样:

<a  class="waves-effect waves-light btn red ">Delete</a>

删除

我想使用 css 选择器,例如:

.red:not(.disabled):first

但是我写在Codeception验收测试用例中

$I->click(['css' =>'.red:not(.disabled):first']);

它会抛出一个错误:

Strict locator is malformed: css => .red:not('.disabled):first

Codeception如何获取这个元素?

更改为 xpath 选择器 '(//*[contains(@class,"red") and not(@disabled)])[1]' 可以帮助您。