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