| @@ 7-18 (lines=12) @@ | ||
| 4 | ||
| 5 | trait Html |
|
| 6 | { |
|
| 7 | protected function countElements($element, $index, $parent) |
|
| 8 | { |
|
| 9 | $page = $this->getSession()->getPage(); |
|
| 10 | ||
| 11 | $parents = $page->findAll('css', $parent); |
|
| 12 | if (!isset($parents[$index - 1])) { |
|
| 13 | throw new \Exception("The $index element '$parent' was not found anywhere in the page"); |
|
| 14 | } |
|
| 15 | ||
| 16 | $elements = $parents[$index - 1]->findAll('css', $element); |
|
| 17 | return count($elements); |
|
| 18 | } |
|
| 19 | ||
| 20 | protected function findElement($selector, $locator, $index) |
|
| 21 | { |
|
| @@ 20-31 (lines=12) @@ | ||
| 17 | return count($elements); |
|
| 18 | } |
|
| 19 | ||
| 20 | protected function findElement($selector, $locator, $index) |
|
| 21 | { |
|
| 22 | $page = $this->getSession()->getPage(); |
|
| 23 | ||
| 24 | $nodes = $page->findAll($selector, $locator); |
|
| 25 | ||
| 26 | if (!isset($nodes[$index - 1])) { |
|
| 27 | throw new \Exception("The $index $selector '$locator' was not found anywhere in the page"); |
|
| 28 | } |
|
| 29 | ||
| 30 | return $nodes[$index - 1]; |
|
| 31 | } |
|
| 32 | } |
|
| 33 | ||