我正在使用Codeception来运行验收测试,我需要计算一个带有“.remove”类的按钮出现在一个页面中的次数。这样的按钮位于html表格内,计数取决于购物车中的物品数量 以下是我正在尝试使用的代码:
$I->amOnPage("/cart/");
$table = $I->grabTextFrom(".//*[@id='cart']/table");
$rows = explode("<tr>", $table);
$rcount = count($rows);
while ($rcount >= 0) {
$I->click(".remove");
$rcount--;
}
$I->see("Your shopping cart is empty.");
答案 0 :(得分:4)
我知道这有点晚了,但您应该尝试$ I-&gt; seeNumberOfElements,如下所述:
http://codeception.com/docs/modules/WebDriver#seeNumberOfElements
答案 1 :(得分:0)
IntArray a = fillArray()