/** * @return $this * @throws WebDriverException */ public function click() { $this->dispatch('beforeClickOn', $this); try { $this->element->click(); } catch (WebDriverException $exception) { $this->dispatchOnException($exception); } $this->dispatch('afterClickOn', $this); return $this; }
/** * An helper function to ensure the new page is load after a click. * * @param WebDriverElement $webDriverElement the element to click. * * @return void */ public function clickToLoadNewPage($webDriverElement) { $webDriverElement->click(); try { while (true) { $webDriverElement->getText(); } } catch (StaleElementReferenceException $e) { return; } }