2017-08-04 24 views
0

我测试的Html像这样:Codeception验收测试如何找到CSS伪类元素

<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怎样才能得到这个元素?

+0

也许还有另一种组合选择器的方式,请在可能的情况下添加元素的html代码段,同时启用和禁用。 – lauda

回答

0

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