i need to test, how many css-selectors appear on webseite. I geht only huge array with nodes, which match on my condition. When i count rows within array, i get "five", but it schould be "three"
My code:
/**
* @Then /^I should see more then one css slider-selector "([^"]*)"$/
* @Then /^I should see more then one CSS slider-selector "([^"]*)"$/
*/
public function iShouldSeeMoreThenOneCssSliderSelector($css_selector) {
$nodes = $this->getSession()->getPage()->findAll("css", $css_selector);
$counter = 0;
foreach($nodes as $row){
if(!empty($row)) {$counter +=1;}
}
if($counter<2){
throw new \Exception(sprintf("The page '%s' does not contain enough pictures for slider '%s'", $this->getSession()->getCurrentUrl(), $css_selector));
}
}
But when i look on html-source, i have only three matches. This code tells, that i have 5 machtes. I guess, i don´t test correctly. Has anybody idea?
Aucun commentaire:
Enregistrer un commentaire