/** * @param WebDriverBy $by * @return EventFiringWebElement * @throws WebDriverException */ public function findElement(WebDriverBy $by) { $this->dispatch('beforeFindBy', $by, $this, $this->dispatcher->getDefaultDriver()); try { $element = $this->newElement($this->element->findElement($by)); } catch (WebDriverException $exception) { $this->dispatchOnException($exception); } $this->dispatch('afterFindBy', $by, $this, $this->dispatcher->getDefaultDriver()); return $element; }