asMainMenu(); } /** * Select main menu section. * * @param string $section first level menu */ public function select($section) { $this->query('link', $section)->waitUntilVisible()->one()->click(); $element = $this->query('xpath://a[text()='.CXPathHelper::escapeQuotes($section). ']/../ul[@class="submenu"]')->one(); // Waits until menu section is expanded. CElementQuery::wait()->until(function () use ($element) { return CElementQuery::getDriver()->executeScript('return arguments[0].clientHeight ==='. ' parseInt(arguments[0].style.maxHeight, 10)', [$element]); }); } /** * Check that the corresponding element exists. * * @param string $page page name * * @return boolean */ public function exists($page) { return ($this->query('link', $page)->one(false)->isValid()); } }