// We just want to expand the node, we don't want to follow it.
$node = $node->getParent();
}
- $node->click();
+ $this->execute('behat_general::i_click_on', [$node, 'NodeElement']);
}
/**
// We just want to expand the node, we don't want to follow it.
$node = $node->getParent();
}
- $node->click();
+ $this->execute('behat_general::i_click_on', [$node, 'NodeElement']);
}
/**
// don't wait, it is non-JS and we already waited for the DOM.
$siteadminlink = $this->getSession()->getPage()->find('named_exact', array('link', "'" . $siteadminstr . "'"));
if ($siteadminlink) {
- $siteadminlink->click();
+ $this->execute('behat_general::i_click_on', [$siteadminlink, 'NodeElement']);
}
}
}
throw new ExpectationException('Navigation node "' . $nodetext . '" not found under "' .
implode(' > ', $parentnodes) . '"', $this->getSession());
}
- $nodetoclick->click();
+ $this->execute('behat_general::i_click_on', [$nodetoclick, 'NodeElement']);
}
/**
$node = $this->find('xpath', $xpath);
$expanded = $node->getAttribute('aria-expanded');
if ($expanded === 'false') {
- $node->click();
+ $this->execute('behat_general::i_click_on', [$node, 'NodeElement']);
$this->ensure_node_attribute_is_set($node, 'aria-expanded', 'true');
- $this->wait_for_pending_js();
}
}
$node = $this->find('xpath', $xpath);
$expanded = $node->getAttribute('aria-expanded');
if ($expanded === 'true') {
- $node->click();
- $this->wait_for_pending_js();
+ $this->execute('behat_general::i_click_on', [$node, 'NodeElement']);
}
}
protected function go_to_main_course_page() {
$url = $this->getSession()->getCurrentUrl();
if (!preg_match('|/course/view.php\?id=[\d]+$|', $url)) {
- $this->find('xpath', '//header//div[@id=\'page-navbar\']//a[contains(@href,\'/course/view.php?id=\')]')->click();
- $this->execute('behat_general::wait_until_the_page_is_ready');
+ $node = $this->find('xpath', '//header//div[@id=\'page-navbar\']//a[contains(@href,\'/course/view.php?id=\')]');
+ $this->execute('behat_general::i_click_on', [$node, 'NodeElement']);
}
}
$tabxpath = '//ul[@role=\'tablist\']/li/a[contains(normalize-space(.), ' . $tabname . ')]';
if ($node = $this->getSession()->getPage()->find('xpath', $tabxpath)) {
if ($this->running_javascript()) {
+ $this->execute('behat_general::i_click_on', [$node, 'NodeElement']);
// Click on the tab and add 'active' tab to the xpath.
- $node->click();
$xpath .= '//div[contains(@class,\'active\')]';
} else {
// Add the tab content selector to the xpath.
if (!$node = $this->getSession()->getPage()->find('xpath', $xpath)) {
throw new ElementNotFoundException($this->getSession(), 'Link "' . join(' > ', $nodelist) . '"');
}
- $node->click();
- $this->wait_for_pending_js();
+ $this->execute('behat_general::i_click_on', [$node, 'NodeElement']);
}
/**
$menuxpath = $this->find_header_administration_menu() ?: $this->find_page_administration_menu();
}
if ($menuxpath && $this->running_javascript()) {
- $this->find('xpath', $menuxpath . '//a[@data-toggle=\'dropdown\']')->click();
- $this->wait_for_pending_js();
+ $node = $this->find('xpath', $menuxpath . '//a[@data-toggle=\'dropdown\']');
+ $this->execute('behat_general::i_click_on', [$node, 'NodeElement']);
}
}
$isheader = false;
}
- $this->toggle_page_administration_menu($menuxpath);
+ $this->execute('behat_navigation::toggle_page_administration_menu', [$menuxpath]);
if (!$isheader || count($nodelist) == 1) {
$lastnode = end($nodelist);
$linkname = behat_context_helper::escape($lastnode);
$link = $this->getSession()->getPage()->find('xpath', $menuxpath . '//a[contains(normalize-space(.), ' . $linkname . ')]');
if ($link) {
- $link->click();
- $this->wait_for_pending_js();
+ $this->execute('behat_general::i_click_on', [$link, 'NodeElement']);
return;
}
}
$linkname = behat_context_helper::escape(get_string('morenavigationlinks'));
$link = $this->getSession()->getPage()->find('xpath', $menuxpath . '//a[contains(normalize-space(.), ' . $linkname . ')]');
if ($link) {
- $link->click();
- $this->execute('behat_general::wait_until_the_page_is_ready');
+ $this->execute('behat_general::i_click_on', [$link, 'NodeElement']);
$this->select_on_administration_page($nodelist);
return;
}