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