我正在使用协同欺骗来运行验收测试,并且我需要计算一个带有".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.");发布于 2014-10-21 01:40:09
我知道这有点晚了,但你应该尝试$i->参见seeNumberOfElements,如下所述:
http://codeception.com/docs/modules/WebDriver#seeNumberOfElements
发布于 2016-09-17 02:38:45
$arrayProducts = $I->grabMultiple(XPATH_PRODUCTS_BOX);
$sumProducts = count($arrayProducts);
$I->comment("In category $selectCategory is total product: $sumProducts");
$I->seeNumberOfElements(XPATH_PRODUCTS_BOX, $sumProducts);
return $sumProducts;https://stackoverflow.com/questions/21011597
复制相似问题