mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-38179 behat: Step definition to click on a table row element
This commit is contained in:
parent
422f68fb86
commit
f9d3667e7b
1 changed files with 22 additions and 0 deletions
|
@ -138,6 +138,28 @@ class behat_general extends behat_base {
|
||||||
$node->click();
|
$node->click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Click on the specified element inside a table row containing the specified text.
|
||||||
|
*
|
||||||
|
* @Given /^I click on "(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>(?:[^"]|\\")*)" in the "(?P<row_text_string>(?:[^"]|\\")*)" table row$/
|
||||||
|
* @throws ElementNotFoundException
|
||||||
|
* @param string $element Element we look for
|
||||||
|
* @param string $selectortype The type of what we look for
|
||||||
|
* @param string $tablerowtext The table row text
|
||||||
|
*/
|
||||||
|
public function i_click_on_in_the_table_row($element, $selectortype, $tablerowtext) {
|
||||||
|
|
||||||
|
// The table row container.
|
||||||
|
$nocontainerexception = new ElementNotFoundException($this->getSession(), '"' . $tablerowtext . '" row text ');
|
||||||
|
$tablerowtext = str_replace("'", "\'", $tablerowtext);
|
||||||
|
$rownode = $this->find('xpath', "//tr[contains(., '" . $tablerowtext . "')]", $nocontainerexception);
|
||||||
|
|
||||||
|
// Looking for the element DOM node inside the specified row.
|
||||||
|
list($selector, $locator) = $this->transform_selector($selectortype, $element);
|
||||||
|
$elementnode = $this->find($selector, $locator, false, $rownode);
|
||||||
|
$elementnode->click();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks, that page contains specified text.
|
* Checks, that page contains specified text.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue