/** * @param WebDriverBy $by * @return array * @throws WebDriverException */ public function findElements(WebDriverBy $by) { $this->dispatch('beforeFindBy', $by, null, $this); try { $elements = array(); foreach ($this->driver->findElements($by) as $element) { $elements[] = $this->newElement($element); } } catch (WebDriverException $exception) { $this->dispatchOnException($exception); } $this->dispatch('afterFindBy', $by, null, $this); return $elements; }