public function expandDiagnoses() { if ($this->isDiagnosesCollapsed()) { $element = $this->getElement('expandDiagnoses'); $this->scrollWindowToElement($element); $element->click(); $this->getSession()->wait(5000, 'window.$ && $.active == 0'); } }